ldc-gen-game-web/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php
2023-12-05 12:33:25 +01:00

43 lines
909 B
PHP

<?php
namespace App\Http\Requests\Bo\Codes;
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')
];
}
}