'int', 'is_admin' => 'bool', 'preferences' => UserPreferencesCast::class, ]; public function playlists(): HasMany { return $this->hasMany(Playlist::class); } public function interactions(): HasMany { return $this->hasMany(Interaction::class); } protected function avatar(): Attribute { return Attribute::get( fn () => sprintf('https://www.gravatar.com/avatar/%s?s=192&d=robohash', md5($this->email)) ); } /** * Determine if the user is connected to Last.fm. */ public function connectedToLastfm(): bool { return (bool) $this->lastfm_session_key; } /** * Get the user's Last.fm session key. * * @return string|null The key if found, or null if user isn't connected to Last.fm */ public function getLastfmSessionKeyAttribute(): ?string { return $this->preferences->lastFmSessionKey; } }