Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| IndexFeatureRequest | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| rules | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| messages | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\v2\Feature; |
| 4 | |
| 5 | use App\Http\Models\Feature; |
| 6 | use App\Http\Requests\v2\Parameter\Concerns\AuthorizesVengresoAdmin; |
| 7 | use Illuminate\Foundation\Http\FormRequest; |
| 8 | use Illuminate\Validation\Rule; |
| 9 | |
| 10 | /** |
| 11 | * Request for listing features. |
| 12 | * |
| 13 | * @property string|null $category Optional category filter (formatting, limits, storage, ai, general) |
| 14 | */ |
| 15 | class IndexFeatureRequest extends FormRequest |
| 16 | { |
| 17 | use AuthorizesVengresoAdmin; |
| 18 | |
| 19 | /** |
| 20 | * Get the validation rules that apply to the request. |
| 21 | * |
| 22 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 23 | */ |
| 24 | public function rules(): array |
| 25 | { |
| 26 | return [ |
| 27 | 'category' => ['sometimes', 'nullable', 'string', Rule::in(Feature::CATEGORIES)], |
| 28 | ]; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Get custom messages for validator errors. |
| 33 | * |
| 34 | * @return array<string, string> |
| 35 | */ |
| 36 | public function messages(): array |
| 37 | { |
| 38 | return [ |
| 39 | 'category.in' => 'The category must be one of: '.implode(', ', Feature::CATEGORIES), |
| 40 | ]; |
| 41 | } |
| 42 | } |