| Current Path : /var/www/html/LLCF-APP/app/Http/Requests/ |
| Current File : /var/www/html/LLCF-APP/app/Http/Requests/ItemFormRequest.php |
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ItemFormRequest extends FormRequest
{
public function authorize(): bool
{
return auth()->guard('admin')->check();
}
public function rules(): array
{
$id = $this->route('id');
return [
'name' => 'required|string|max:255|unique:items,name,' . $id,
];
}
public function attributes(): array
{
return [
'name' => 'item name',
];
}
}