ldc-gen-game-web/app/Http/Requests/Bo/Codes/CodeSearchRequest.php

47 lines
902 B
PHP
Raw Permalink Normal View History

2022-01-10 16:58:25 +01:00
<?php
2026-10-02 12:09:46 +02:00
declare(strict_types=1);
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.
*
2026-10-02 12:09:46 +02:00
* @return bool
2022-01-10 16:58:25 +01:00
*/
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 [
2026-10-02 12:09:46 +02:00
'code' => 'required|string|min:1|max:25',
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 [
2026-10-02 12:09:46 +02:00
'code' => trans('code'),
2023-11-30 16:58:36 +01:00
];
}
2022-01-10 16:58:25 +01:00
}