gpt-4.1-2025-04-14· OpenAI
LMArena Human Preference 140K
добавь так же новые поля в запрос <?php declare(strict_types=1); namespace…
- User
добавь так же новые поля в запрос
- Assistant
Вот как будет выглядеть обновлённый
EventFormRequestс учётом всех новых полей из миграции:<?php declare(strict_types=1); namespace App\Http\Requests; use App\Models\Enums\AuthorizationStepEnum; use App\Models\Enums\EventOwnerEnum; use App\Models\Enums\EventTypeEnum; use App\Models\Enums\TicketAgentEnum; use App\Models\Enums\YesNoEnum; use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rule; use Override; class EventFormRequest 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, ValidationRule|array|string> */ public function rules(): array { return [ 'model.id' => 'nullable', 'model.active' => [Rule::in(YesNoEnum::values())], 'model.owner' => ['required', Rule::in(EventOwnerEnum::values())], 'model.title' => ['required', 'string', 'max:255'], 'model.type' => ['required', Rule::in(EventTypeEnum::values())], 'model.authorization_step' => ['required', Rule::in(AuthorizationStepEnum::values())], 'model.allow_quick_booking' => [Rule::in(YesNoEnum::values())], 'model.registration_required' => [Rule::in(YesNoEnum::values())], 'model.show_tariff_information' => [Rule::in(YesNoEnum::values())], // Новые поля 'model.start_activity_at' => 'nullable|date', 'model.end_activity_at' => 'nullable|date|after_or_equal:model.start_activity_at', 'model.ticket_agent' => ['required', Rule::in(TicketAgentEnum::values())], 'model.tariff_id' => 'nullable|uuid', 'model.tariff' => [Rule::in(YesNoEnum::values())], 'model.provide_spb_discount' => [Rule::in(YesNoEnum::values())], 'model.start_sales_at' => 'nullable|date', 'model.end_sales_at' => 'nullable|date|after_or_equal:model.start_sales_at', 'model.sales_duration' => 'nullable|integer|min:0', 'model.days_until_available' => 'nullable|integer|min:0', 'model.button_text' => 'nullable|array', 'model.additional_info' => 'nullable|array', 'model.additional_file_path' => 'nullable|array', ]; } /** * Get custom attributes for validator errors. * * @return array<string, string> */ #[Override] public function attributes(): array { return [ 'model.id' => __('event.fields.id.title'), 'model.active' => __('event.fields.active.title'), 'model.owner' => __('event.fields.owner.title'), 'model.title' => __('event.fields.title.title'), 'model.type' => __('event.fields.type.title'), 'model.authorization_step' => __('event.fields.authorization_step.title'), 'model.allow_quick_booking' => __('event.fields.allow_quick_booking.title'), 'model.registration_required' => __('event.fields.registration_required.title'), 'model.show_tariff_information' => __('event.fields.show_tariff_information.title'), 'model.start_activity_at' => __('event.fields.start_activity_at.title'), 'model.end_activity_at' => __('event.fields.end_activity_at.title'), // Новые поля 'model.ticket_agent' => __('event.fields.ticket_agent.title'), 'model.tariff_id' => __('event.fields.tariff_id.title'), 'model.tariff' => __('event.fields.tariff.title'), 'model.provide_spb_discount' => __('event.fields.provide_spb_discount.title'), 'model.start_sales_at' => __('event.fields.start_sales_at.title'), 'model.end_sales_at' => __('event.fields.end_sales_at.title'), 'model.sales_duration' => __('event.fields.sales_duration.title'), 'model.days_until_available' => __('event.fields.days_until_available.title'), 'model.button_text' => __('event.fields.button_text.title'), 'model.additional_info' => __('event.fields.additional_info.title'), 'model.additional_file_path' => __('event.fields.additional_file_path.title'), ]; } }Примечания:
- Для перечислений (
Enum) обязательно должны быть реализованы методыvalues(), возвращающие массив возможных значений. - Если какие-то поля не обязательны, можно добавить
nullable. - Для массивов (
json-полей) используется правилоarray. - Для дат — правило
date, для UUID —uuid. - Для числовых значений —
integer|min:0.
Если потребуется добавить валидацию для вложенных массивов (например, для локализации в
button_text), это можно сделать черезarray.*или кастомные правила. - Для перечислений (
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.