mistral-medium-2505· Mistral AI LMArena Human Preference 140K
на основе миграции <?php declare(strict_types=1); use…
- User
на основе миграции
- Assistant
Вот доработанная модель
Eventс добавленными полями, описаниями и отношениями с другими таблицами:<?php declare(strict_types=1); namespace App\Models; use App\Models\Casts\UTC; 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 App\Models\Traits\HasActiveTrait; use App\Orchid\Filters\AuthorizationStepFilter; use App\Orchid\Filters\EventOwnerFilter; use App\Orchid\Filters\TypeFilter; use App\Orchid\Filters\YesNoFilter; use Carbon\Carbon; use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Orchid\Filters\Filterable; use Orchid\Filters\Types\Like; use Orchid\Screen\AsSource; /** * @property string $id UUID идентификатор * @property Carbon $created_at Дата создания * @property Carbon $updated_at Дата обновления * @property YesNoEnum $active Активность (по умолчанию: Yes) * @property EventOwnerEnum $owner Владелец мероприятия * @property string $title Заголовок мероприятия * @property EventTypeEnum $type Тип мероприятия * @property AuthorizationStepEnum $authorization_step Шаг авторизации * @property YesNoEnum $allow_quick_booking Разрешить быстрое бронирование * @property YesNoEnum $registration_required Обязательная регистрация * @property YesNoEnum $show_tariff_information Отображать информацию по тарифам * @property Carbon|null $start_activity_at Начало активности * @property Carbon|null $end_activity_at Окончание активности * @property TicketAgentEnum $ticket_agent Билетный агент * @property string|null $tariff_id ID выбранного тарифа * @property YesNoEnum $tariff Тариф * @property YesNoEnum $provide_spb_discount Предоставить скидку по СПБ * @property Carbon|null $start_sales_at Начало продаж * @property Carbon|null $end_sales_at Окончание продаж * @property int $sales_duration Длительность продаж (дни) * @property int $days_until_available Доступно через X дней * @property array|null $button_text Текст кнопки * @property array|null $additional_info Дополнительная информация * @property array|null $additional_file_path Путь к дополнительному файлу */ class Event extends Model { use AsSource; use Filterable; use HasActiveTrait; use HasFactory; use HasUuids; /** * The attributes that are mass assignable. * * @var array<string> */ protected $fillable = [ 'id', 'active', 'owner', 'title', 'type', 'authorization_step', 'allow_quick_booking', 'registration_required', 'show_tariff_information', 'start_activity_at', 'end_activity_at', 'ticket_agent', 'tariff_id', 'tariff', 'provide_spb_discount', 'start_sales_at', 'end_sales_at', 'sales_duration', 'days_until_available', 'button_text', 'additional_info', 'additional_file_path', ]; /** * The model's default values for attributes. * * @var array<string, mixed> */ protected $attributes = [ 'active' => YesNoEnum::YES->value, 'owner' => EventOwnerEnum::VDNH, 'type' => EventTypeEnum::WIDGET, 'authorization_step' => AuthorizationStepEnum::NOT_SELECT, 'allow_quick_booking' => YesNoEnum::NO->value, 'registration_required' => YesNoEnum::NO->value, 'show_tariff_information' => YesNoEnum::NO->value, 'ticket_agent' => TicketAgentEnum::ISD, 'tariff' => YesNoEnum::YES->value, 'provide_spb_discount' => YesNoEnum::NO->value, 'sales_duration' => 60, 'days_until_available' => 0, ]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = [ 'type' => EventTypeEnum::class, 'owner' => EventOwnerEnum::class, 'authorization_step' => AuthorizationStepEnum::class, 'ticket_agent' => TicketAgentEnum::class, 'active' => YesNoEnum::class, 'allow_quick_booking' => YesNoEnum::class, 'registration_required' => YesNoEnum::class, 'show_tariff_information' => YesNoEnum::class, 'tariff' => YesNoEnum::class, 'provide_spb_discount' => YesNoEnum::class, 'start_activity_at' => UTC::class . ':d-m-Y H:i,Y-m-d H:i:s', 'end_activity_at' => UTC::class . ':d-m-Y H:i,Y-m-d H:i:s', 'start_sales_at' => UTC::class . ':d-m-Y H:i,Y-m-d H:i:s', 'end_sales_at' => UTC::class . ':d-m-Y H:i,Y-m-d H:i:s', 'button_text' => 'array', 'additional_info' => 'array', 'additional_file_path' => 'array', ]; /** * The attributes that can be filtered. * * @var array<string, string> */ protected array $allowedFilters = [ 'id' => Like::class, 'title' => Like::class, 'type' => TypeFilter::class, 'owner' => EventOwnerFilter::class, 'authorization_step' => AuthorizationStepFilter::class, 'allow_quick_booking' => YesNoFilter::class, 'registration_required' => YesNoFilter::class, 'show_tariff_information' => YesNoFilter::class, 'active' => YesNoFilter::class, 'ticket_agent' => YesNoFilter::class, 'tariff' => YesNoFilter::class, 'provide_spb_discount' => YesNoFilter::class, ]; /** * The attributes for which can use sort in url. * * @var array<string> */ protected array $allowedSorts = [ 'id', 'created_at', 'updated_at', 'owner', 'type', 'title', 'start_activity_at', 'end_activity_at', 'start_sales_at', 'end_sales_at', 'sales_duration', 'days_until_available', ]; /** * Get the promo codes associated with the event. * * @return BelongsToMany<PromoCode> */ public function promoCodes(): BelongsToMany { return $this->belongsToMany(PromoCode::class, 'events_promo_codes_links', 'event_id', 'promo_code_id'); } /** * Get the loyalty programs associated with the event. * * @return BelongsToMany<LoyaltyProgram> */ public function loyaltyPrograms(): BelongsToMany { return $this->belongsToMany(LoyaltyProgram::class, 'events_loyalty_programs_links', 'event_id', 'loyalty_program_id'); } /** * Get the excluded dates for the event. * * @return HasMany<EventExcludedDate> */ public function excludedDates(): HasMany { return $this->hasMany(EventExcludedDate::class, 'event_id'); } /** * Get the excluded weekdays for the event. * * @return HasMany<EventExcludedWeekday> */ public function excludedWeekdays(): HasMany { return $this->hasMany(EventExcludedWeekday::class, 'event_id'); } }Основные изменения и дополнения:
-
Добавлены все недостающие поля из миграции с соответствующими типами и описаниями
-
Добавлены отношения с другими моделями:
promoCodes()- связь многие-ко-многим с промокодамиloyaltyPrograms()- связь многие-ко-многим с программами лояльностиexcludedDates()- связь один-ко-многим с исключенными датамиexcludedWeekdays()- связь один-ко-многим с исключенными днями недели
-
Обновлены:
- Массив
$fillableс добавлением новых полей - Массив
$attributesс добавлением значений по умолчанию для новых полей - Массив
$castsс добавлением кастинга для новых полей - Массив
$allowedFiltersс добавлением фильтров для новых полей - Массив
$allowedSortsс добавлением сортировки для новых полей
- Массив
-
Добавлены соответствующие use-операторы для новых классов и типов
Модель теперь полностью соответствует миграции и включает все необходимые отношения с другими таблицами.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.