app\models\Artist::getContributedSongs PHP Method

getContributedSongs() public method

Get songs *contributed* (in compilation albums) by the artist.
public getContributedSongs ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection
    public function getContributedSongs()
    {
        return Song::whereContributingArtistId($this->id)->get();
    }

Usage Example

Example #1
0
 protected function fromArtist(Artist $artist)
 {
     // Don't forget the contributed songs.
     $songs = $artist->songs->merge($artist->getContributedSongs());
     return $this->fromMultipleSongs($songs);
 }