vendredi 23 décembre 2016

Laravel - A show can have multiple providers

So I am trying to figure a solution to this but not sure exactly how to do this. I have a table that stores all the shows that happen. In a given show I can have multiple providers attend that show. So how do I store this in the DB and do the eloquent relationship?

Show Schema

Schema::create('shows', function (Blueprint $table) {
  $table->increments('id');
  $table->string('name');
  $table->integer('number')->unsigned();
  $table->dateTime('airDate');
  $table->string('podcastUrl')->nullable();
  $table->timestamps();
});

Provider Schema

Schema::create('providers', function (Blueprint $table) {
  $table->increments('id');
  $table->string('name');
  $table->string('shortName')->nullable();
  $table->string('image')->nullable();
  $table->string('social')->nullable();
  $table->timestamps();
});

Would I store the provider_id in the shows schema?



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

Aucun commentaire:

Enregistrer un commentaire