share-lt/app/Http/Requests/UpdateCategoryRequest.php
jon brookes f980be8e28 feature: add api for categories
feature: add initial docker build and compose for development mode
2026-01-15 17:39:59 +00:00

28 lines
708 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->user() && $this->user()->email === config('app.admin_email');
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'sometimes|required|string|max:255|unique:categories,name,'.$this->category->id,
];
}
}