belongsToMany('App\Playlist'); } public function getNameAttribute() { return $this->title . ( $this->author ? " ($this->author)" : "" ); } }