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
|
|
|
|
2023-12-05 12:33:25 +01:00
|
|
|
use App\Models\Code;
|
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
|
|
|
|
|
|
|
|
class CodeSearchRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function authorize()
|
|
|
|
|
{
|
2023-12-05 12:33:25 +01:00
|
|
|
return Gate::check('search', Code::class);
|
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 [
|
|
|
|
|
'code' => 'required|string|min:1|max:25'
|
|
|
|
|
];
|
|
|
|
|
}
|
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 [
|
|
|
|
|
'code' => trans('code')
|
|
|
|
|
];
|
|
|
|
|
}
|
2022-01-10 16:58:25 +01:00
|
|
|
}
|