ldc-gen-game-web/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php
2026-10-20 12:27:49 +02:00

44 lines
927 B
PHP

<?php
declare(strict_types=1);
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.
*/
public function authorize(): bool
{
return Gate::check('generate', Code::class) && $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'),
];
}
}