'datetime', 'end_date' => 'datetime', 'early_bird_end' => 'datetime', 'registration_final_end' => 'datetime', 'early_bird_end_amount_increase' => 'integer', 'registration_final_end_amount_increase' => 'integer', 'alcoholics_age' => 'integer', 'registration_allowed' => 'boolean', 'pay_per_day' => 'boolean', 'pay_direct' => 'boolean', 'send_weekly_report' => 'boolean', 'archived' => 'boolean', 'support_per_person' => AmountCast::class, 'support_flat' => AmountCast::class, 'total_max_amount' => AmountCast::class, ]; public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class, 'tenant', 'slug'); } public function costUnit(): BelongsTo { return $this->belongsTo(CostUnit::class); } public function participationFeeType(): BelongsTo { return $this->belongsTo(ParticipationFeeType::class, 'participation_fee_type', 'slug'); } public function participationFee1(): BelongsTo { return $this->belongsTo(EventParticipationFee::class, 'participation_fee_1'); } public function participationFee2(): BelongsTo { return $this->belongsTo(EventParticipationFee::class, 'participation_fee_2'); } public function participationFee3(): BelongsTo { return $this->belongsTo(EventParticipationFee::class, 'participation_fee_3'); } public function participationFee4(): BelongsTo { return $this->belongsTo(EventParticipationFee::class, 'participation_fee_4'); } public function localGroups() : BelongsToMany{ return $this->belongsToMany(Tenant::class, 'event_local_groups', 'event_id', 'local_group_id'); } public function eatingHabits() : BelongsToMany{ return $this->belongsToMany(EatingHabit::class, 'event_allowed_eating_habits', 'event_id', 'eating_habit_id'); } public function resetContributingLocalGroups() { $this->localGroups()->detach(); $this->save(); } public function resetAllowedEatingHabits() { $this->eatingHabits()->detach(); $this->save(); } public function resetMangers() { $this->eventManagers()->detach(); $this->save(); } public function eventManagers() : BelongsToMany { return $this->belongsToMany(User::class, 'event_managers', 'event_id', 'user_id') ->withTimestamps(); } public function participants() : hasMany { return $this->hasMany(EventParticipant::class); } }