ldc-gen-game-web/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php
noah.lancien 218a3a7891 phpstan
2024-01-31 09:03:18 +00:00

44 lines
930 B
PHP

<?php
namespace App\Http\Requests\Bo\Codes;
use App\Models\Code;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class GenerateCodesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return Gate::check('generate', Code::class) and $this->json();
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string,string>
*/
public function rules(): array
{
return [
'quantity' => 'required|integer|min:1'
];
}
/**
* Get custom attributes for validator errors.
*
* @return array<string,string>
*/
public function attributes(): array
{
return [
'quantity' => trans('validation.custom.quantity')
];
}
}