/
orlov-seeker
/
cube.example
Обзор
Документация
Войти
/
orlov-seeker
/
cube.example
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
app/Http/Requests/CubeRequest.php
47 строк
1 KB
Орлов Павел Геннадьевич
Добавлена валидация
30 янв 2025, 10:22
30 янв 2025, 10:22
be82120
Код
Авторство
О чём код?
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class CubeRequest extends FormRequest { /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. * * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> */ public function rules(): array { return [ 'width' => ['required', 'numeric', 'min:0'], 'height' => ['required', 'numeric', 'min:0'], ]; } /** * Get the error messages for the defined validation rules. * * @return array<string, string> */ public function messages(): array { return [ 'height.required' => 'Необходимо ввести длинну стороны', 'height.numeric' => 'Необходимо ввести число', 'height.min' => 'Длинна стороны должна быть больше :min', 'width.required' => 'Необходимо ввести ширину стороны', 'width.numeric' => 'Необходимо ввести число', 'width.min' => 'Ширина стороны должна быть больше :min', ]; } }