*/ use HasFactory, Notifiable, HasApiTokens; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } /** * Get all favorites for this user */ public function favorites(): HasMany { return $this->hasMany(Favorite::class); } /** * Get all favorite cities for this user */ public function favoriteCities(): BelongsToMany { return $this->belongsToMany(City::class, 'favorites') ->withTimestamps(); } /** * Get all trips for this user */ public function trips(): HasMany { return $this->hasMany(Trip::class); } }