Pivot scaffolding and new views for adding beers

This commit is contained in:
2021-09-05 02:09:38 +02:00
parent 26dbfeb94a
commit f4c030934a
11 changed files with 124 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ class CreateBeersTable extends Migration
public function up()
{
Schema::create('beers', function (Blueprint $table) {
$table->unsignedBigInteger('id');
$table->id();
$table->string('beer');
$table->integer('rating');
$table->string('country');

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ListBeersPivotTable extends Migration
class BeerListPivot extends Migration
{
/**
* Run the migrations.
@@ -13,10 +13,10 @@ class ListBeersPivotTable extends Migration
*/
public function up()
{
Schema::create('list_beers_pivot', function (Blueprint $table) {
$table->unsignedBigInteger('id');
$table->unsignedBigInteger('beer_id');
$table->unsignedBigInteger('list_id');
Schema::create('beer_list_pivot', function (Blueprint $table) {
$table->id();
$table->foreignId('beer_id')->constrained();
$table->foreignId('list_id')->constrained();
});
}
@@ -27,6 +27,6 @@ class ListBeersPivotTable extends Migration
*/
public function down()
{
Schema::dropIfExists('list_beers_pivot');
//
}
}