2025-07-28 09:46:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Bo\Claims;
|
|
|
|
|
|
|
|
|
|
use App\Enums\Claims\ClaimResponseType;
|
|
|
|
|
use App\Enums\Claims\ClaimStatus;
|
|
|
|
|
use App\Enums\Claims\ClaimType;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rules\Enum;
|
|
|
|
|
|
|
|
|
|
class UpdateClaimRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return auth('backend')->check();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'brand_id' => 'required|numeric|exists:brands,id',
|
|
|
|
|
'subject_id' => 'required|numeric|exists:claim_subjects,id',
|
|
|
|
|
'type' => ['required', new Enum(ClaimType::class)],
|
|
|
|
|
'status' => ['required', new Enum(ClaimStatus::class)],
|
|
|
|
|
'response_type' => ['present', 'nullable', new Enum(ClaimResponseType::class)],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get custom attributes for validator errors.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string,\Illuminate\Contracts\Translation\Translator|string|array<mixed>|null>
|
|
|
|
|
*/
|
|
|
|
|
public function attributes(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'brand_id' => trans('models.classes.brands'),
|
2025-08-04 10:04:48 +02:00
|
|
|
'subject_id' => trans('models.classes.claimsubjects'),
|
2025-07-28 09:46:22 +02:00
|
|
|
'type' => trans('validation.custom.type'),
|
|
|
|
|
'status' => trans('validation.custom.status'),
|
|
|
|
|
'response_type' => trans('validation.custom.response_type'),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|