Boilerplate for Listing resource

This commit is contained in:
2025-11-05 02:18:59 -08:00
parent b20e2258b2
commit 8355d57fc4
9 changed files with 276 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreListingRequest;
use App\Http\Requests\UpdateListingRequest;
use App\Models\Listing;
class ListingController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreListingRequest $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Listing $listing)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Listing $listing)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateListingRequest $request, Listing $listing)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Listing $listing)
{
//
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreListingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateListingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

12
app/Models/Listing.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Listing extends Model
{
/** @use HasFactory<\Database\Factories\ListingFactory> */
use HasFactory;
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Listing;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class ListingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return false;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Listing $listing): bool
{
return false;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Listing $listing): bool
{
return false;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Listing $listing): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Listing $listing): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Listing $listing): bool
{
return false;
}
}