mercredi 21 août 2019

How to create a pivot table with unique seed data in Laravel?

I have the following Movies table and Actors table with a pivot table of Movie_Actor.

 Entity Relationship Diagram Example (UML Notation)

How do I create a pivot table Movie_Actor pivot table and provide many-to-many relationship with Eloquent and seed the Movie_Actor table with unique faker data between the Movies and Actors.

For example, 1 movie has many actors and Actors have many movies. If there are 20 movies and 80 Actors how can I build Faker data for the Movie_Actor.

ps. I have already provided Faker content for Movies and Actors
pps. I have search StackOverflow for other answers still struggling with this concept
ppps. I have watched Laracasts videos and YouTube series which cover this topic.
pppps. I know Laravel has generators which help create pivot tables
ppppps. I have tried to use the Laravel Documentation on Eloquent relationships



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZhKdPJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire