43 lines
996 B
PHP
43 lines
996 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Loan;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class LoanCalculateInterestRequest 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.
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'year' => ['required', 'integer', 'min:2000', 'max:2100'],
|
||
|
|
'user_id' => ['nullable', 'integer', 'exists:users,id'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation attribute names.
|
||
|
|
*
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
public function attributes(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'year' => __('validation.attributes.year'),
|
||
|
|
'user_id' => __('validation.attributes.user_id'),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|