Ekapp/skolehjem/database/seeds/WashingMachineSeeder.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?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();
}
}
}