I have the following models:
Song
Artist
Playlist
Pivot tables:
song_artist artist_song
song_playlist playlist_song
Relationships:
A song belongs to many artists
A song belongs to many playlists
Goal
I want to create a relation manager in the Artist resource that lists all playlists containing at least one song by that artist.
Problem
I’m trying to define a relationship between the Artist and Playlist models, but I’m not sure how to connect them through the existing pivots—or if this is even possible.
Question
How can I define this relationship so I can access an artist’s playlists through their songs? I guess I need it as an eloquent relationship so i can properly setup the relation manager