ldc-legaulois/app/Http/Requests/Bo/Claims/StoreClaimRequest.php
2026-09-25 16:25:31 +02:00

53 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests\Bo\Claims;
use App\Models\Claim;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class StoreClaimRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return Gate::check('create', Claim::class);
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'published' => $this->boolean('published'),
]);
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'label' => 'required|string|between:3,255',
'published' => 'required|boolean',
];
}
/**
* Get custom attributes for validator errors.
*/
public function attributes(): array
{
return [
'label' => trans('validation.custom.label'),
'published' => trans('validation.attributes.published'),
];
}
}