v0.10.1 - Added location on washing_reservations and created a WashingMachineSeeder.php
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class WashingMachineSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$machines = [
|
||||
[
|
||||
"name" => "Vaskemaskine nr. 1",
|
||||
"location_id" => 1
|
||||
],
|
||||
[
|
||||
"name" => "Vaskemaskine nr. 2",
|
||||
"location_id" => 1
|
||||
],
|
||||
[
|
||||
"name" => "Vaskemaskine nr. 3",
|
||||
"location_id" => 1
|
||||
],
|
||||
|
||||
[
|
||||
"name" => "Vaskemaskine nr. 1",
|
||||
"location_id" => 2
|
||||
],
|
||||
[
|
||||
"name" => "Vaskemaskine nr. 2",
|
||||
"location_id" => 2
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($machines as $machineData) {
|
||||
$machine = new \App\WashingMachine();
|
||||
|
||||
$machine->name = $machineData["name"];
|
||||
$machine->location_id = $machineData["location_id"];
|
||||
|
||||
$machine->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user