*/ protected $casts = [ 'start_date' => 'date', 'end_date' => 'date', ]; /** * Get the name of the group * * @return Attribute * */ public function name(): Attribute { return Attribute::make( get: fn ($value) => $this->start_date->format('d M') . ' - ' . $this->end_date->format('d M'), ); } public function pilgrims(): HasMany { return $this->hasMany(Pilgrim::class); } public function leaderTeacher(): BelongsTo { return $this->belongsTo(Teacher::class, 'leader_teacher_id'); } public function helperTeachers(): BelongsToMany { return $this->belongsToMany(Teacher::class, 'group_teacher'); } }