2025-11-24 12:58:47 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Bo\Claims;
|
|
|
|
|
|
2025-12-02 09:48:28 +01:00
|
|
|
use App\Enums\ExportFormat;
|
2025-11-24 12:58:47 +01:00
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2025-11-25 14:57:34 +01:00
|
|
|
use Illuminate\Validation\Rule;
|
2025-11-24 12:58:47 +01:00
|
|
|
|
|
|
|
|
class ExportClaimRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return auth('backend')->check();
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-27 16:19:48 +01:00
|
|
|
/**
|
|
|
|
|
* Prepare the data for validation.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2025-11-24 12:58:47 +01:00
|
|
|
public function prepareForValidation()
|
|
|
|
|
{
|
|
|
|
|
$this->merge([
|
|
|
|
|
'claimList' => json_decode($this->input('claimList'), true)
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2025-11-25 14:57:34 +01:00
|
|
|
'format' => [
|
|
|
|
|
'required',
|
2025-12-02 09:48:28 +01:00
|
|
|
Rule::enum(ExportFormat::class)
|
2025-11-25 14:57:34 +01:00
|
|
|
],
|
2025-11-24 12:58:47 +01:00
|
|
|
'claimList' => 'required|array',
|
|
|
|
|
'claimList.*' => 'required|numeric|exists:claims,id',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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'),
|
|
|
|
|
'subject_id' => trans('models.classes.claimsubjects'),
|
|
|
|
|
'type' => trans('validation.custom.type'),
|
|
|
|
|
'status' => trans('validation.custom.status'),
|
|
|
|
|
'response_type' => trans('validation.custom.response_type'),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|