v0.10.1 - Added location on washing_reservations and created a WashingMachineSeeder.php

This commit is contained in:
frederikpyt
2020-08-17 15:06:48 +02:00
parent e82c793820
commit 983b02e00e
4 changed files with 54 additions and 22 deletions
@@ -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();
}
}
}