ldc-supportweb/app/Http/Requests/Bo/Packages/StorePackageRequest.php
2023-08-14 09:23:39 +00:00

45 lines
932 B
PHP

<?php
namespace App\Http\Requests\Bo\Packages;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class StorePackageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return Gate::allows('isAdmin');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string|max:255',
'amount' => 'required|numeric|regex:/^\d+(\.\d{1,2})?$/',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'name' => trans('Nom'),
'amount' => trans('Montant (par jour)'),
];
}
}