New-Thanasoft/thanasoft-back/app/Http/Requests/StoreTvaRateRequest.php

48 lines
1.3 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreTvaRateRequest 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' => 'required|string|max:50',
'rate' => 'required|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.required' => 'Le nom du taux de TVA est requis.',
'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.required' => 'Le taux de TVA est requis.',
'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.',
];
}
}