Support the ongoing development of Laravel.io →
Database Eloquent Installation

Hi, I started with a new application, but I struggle with setting up my Models and Relations. Let me give you a quick idea of my project:

I have 3 Models: User, Playlist and Radio. I want Users to select radio stations from a predefined list of stations and add them to their playlists. A User has playlists and these playlists have radio stations. But the User isn't the actual owner of the radio station.

So my question is: How do I handle the removal of a station for example? What if a User wants to delete a station from his playlist? Or the other way arround: How can I associate a station with a user/playlist?

I know this question sounds weird, but thats because I can't really find the right words to describe my problem.

I hope you will understand :)

Lukas

Last updated 2 years ago.
0

You need a many to many relationship for stations and users. an intermediate pivot table would do just fine. https://laracasts.com/series/laravel-5-fundamentals/episodes/21

0

Sign in to participate in this thread!

Eventy

Your banner here too?

LukasMa lukasma Joined 26 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.