*/ protected $fillable = [ 'code', 'chief', '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 drivers(): BelongsToMany { return $this->belongsToMany( User::class, 'services_drivers', 'service_id', 'user_id' ); } public function crew(): BelongsToMany { return $this->belongsToMany( User::class, 'services_crew', 'service_id', 'user_id' ); } public function type(): BelongsTo { return $this->belongsTo(ServiceType::class); } public function place(): BelongsTo { return $this->belongsTo(Place::class); } /** * 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); } }