added Orte-Table
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user