47 lines
928 B
PHP
47 lines
928 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\V1\Report;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class ExpenseEstimateRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'year_month' => ['nullable', 'regex:/^\d{4}-\d{2}$/'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Custom attribute names
|
||
|
|
*/
|
||
|
|
public function attributes(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'year_month' => __('validation.attributes.year_month'),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Custom validation messages
|
||
|
|
*/
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'year_month.regex' => __('validation.date_format', ['format' => 'YYYY-MM']),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|