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