added Orte-Table

This commit is contained in:
chrosey
2017-07-08 10:26:50 +02:00
parent 8b98db74a2
commit 8cfa2762db
9 changed files with 109 additions and 3557 deletions
@@ -0,0 +1,46 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOrtTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('orte', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('name',50);
});
Schema::table('veranstaltungen', function (Blueprint $table) {
$table->integer('ort_id')->unsigned()->nullable();
$table->foreign('ort_id')->references('id')->on('orte');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('veranstaltungen', function (Blueprint $table) {
$table->dropColumn('ort_id');
});
Schema::dropIfExists('orte');
}
}
+2
View File
@@ -14,5 +14,7 @@ class DatabaseSeeder extends Seeder
// $this->call(UsersTableSeeder::class);
$this->call('ArbeitsplatzSeeder');
$this->command->info('Arbeitsplatz-table seeded!');
$this->call('OrteSeeder');
$this->command->info("Orte-table seeded!");
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Seeder;
use App\Ort;
class OrteSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Ort::firstOrCreate(['name' => 'großes Haus']);
Ort::firstOrCreate(['name' => 'Studiobühne']);
Ort::firstOrCreate(['name' => 'Theatrium']);
Ort::firstOrCreate(['name' => 'Foyer']);
Ort::firstOrCreate(['name' => 'Domstufen']);
Ort::firstOrCreate(['name' => 'siehe Hinweise']);
}
}