35 lines
954 B
PHP
35 lines
954 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\V1\AiReport;
|
||
|
|
|
||
|
|
use App\Models\Tenants\AiReport;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class AiReportGenerateRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'report_date' => ['nullable', 'date', 'before_or_equal:today'],
|
||
|
|
'report_type' => ['nullable', 'string', Rule::in(array_keys(AiReport::REPORT_TYPES))],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'report_date.before_or_equal' => __('validation.before_or_equal', [
|
||
|
|
'attribute' => __('validation.attributes.report_date'),
|
||
|
|
'date' => __('validation.attributes.today'),
|
||
|
|
]),
|
||
|
|
'report_type.in' => __('validation.in', ['attribute' => __('validation.attributes.report_type')]),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|