46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateTvaRateRequest 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 [
|
|
'name' => 'sometimes|string|max:50',
|
|
'rate' => 'sometimes|numeric|min:0|max:999.99',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the error messages for the defined validation rules.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'name.string' => 'Le nom doit être une chaîne de caractères.',
|
|
'name.max' => 'Le nom ne peut pas dépasser 50 caractères.',
|
|
'rate.numeric' => 'Le taux doit être un nombre.',
|
|
'rate.min' => 'Le taux ne peut pas être négatif.',
|
|
'rate.max' => 'Le taux ne peut pas dépasser 999.99.',
|
|
];
|
|
}
|
|
}
|