*/ public $casts = [ 'from' => 'date', 'to' => 'date', 'promised_at' => 'date', ]; public function activity(): BelongsTo { return $this->belongsTo(Activity::class); } public function subactivity(): BelongsTo { return $this->belongsTo(Subactivity::class); } /** * @param Builder $query * * @return Builder */ public function scopeIsAgeGroup(Builder $query): Builder { return $query->whereHas('subactivity', fn ($builder) => $builder->where('is_age_group', true)); } /** * @param Builder $query * * @return Builder */ public function scopeIsMember(Builder $query): Builder { return $query->whereHas('activity', fn ($builder) => $builder->where('is_member', true)); } /** * @param Builder $query * * @return Builder */ public function scopeIsLeader(Builder $query): Builder { return $query->whereHas('activity', fn ($builder) => $builder->where('has_efz', true)); } /** * @param Builder $query * * @return Builder */ public function scopeTrying(Builder $query): Builder { return $query->whereHas('activity', fn ($builder) => $builder->where('is_try', true)); } }