*/ protected $fillable = [ 'name', 'place', 'notes' ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'start' => 'datetime', 'end' => 'datetime' ]; public function chief(): BelongsTo { return $this->belongsTo(User::class); } public function crew(): BelongsToMany { return $this->belongsToMany( User::class, 'trainings_crew', 'training_id', 'user_id' ); } /** * Get the user that added the service. */ public function addedBy(): BelongsTo { return $this->belongsTo(User::class); } /** * Get the user that added the service. */ public function updatedBy(): BelongsTo { return $this->belongsTo(User::class); } }