2022-12-08 09:30:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class CinemaSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the database seeds.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
|
|
|
$cinemas = [
|
|
|
|
[
|
|
|
|
'cinema_name' => 'Cinema 1',
|
|
|
|
'cinema_address' => [
|
|
|
|
'address_line_1' => '123 Main Street',
|
|
|
|
'address_line_2' => 'Suite 1',
|
|
|
|
'address_city' => 'City',
|
|
|
|
'address_state' => 'State',
|
|
|
|
'address_zip' => '12345',
|
|
|
|
'address_phone' => '123-456-7890',
|
|
|
|
],
|
2023-01-01 20:13:11 +01:00
|
|
|
'cinema_open' => '10:00:00',
|
|
|
|
'cinema_close' => '22:00:00',
|
2022-12-08 09:30:07 +01:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'cinema_name' => 'Cinema 2',
|
|
|
|
'cinema_address' => [
|
|
|
|
'address_line_1' => '123 Main Street',
|
|
|
|
'address_line_2' => 'Suite 2',
|
|
|
|
'address_city' => 'City',
|
|
|
|
'address_state' => 'State',
|
|
|
|
'address_zip' => '12345',
|
|
|
|
'address_phone' => '123-456-7890',
|
|
|
|
],
|
2023-01-01 20:13:11 +01:00
|
|
|
'cinema_open' => '12:00:00',
|
|
|
|
'cinema_close' => '23:00:00',
|
2022-12-08 09:30:07 +01:00
|
|
|
]
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($cinemas as $cinema) {
|
|
|
|
$c = new \App\Models\Cinema();
|
|
|
|
$c->cinema_name = $cinema['cinema_name'];
|
|
|
|
$c->user_id = 1;
|
2023-01-01 20:13:11 +01:00
|
|
|
$c->cinema_open = $cinema['cinema_open'];
|
|
|
|
$c->cinema_close = $cinema['cinema_close'];
|
2022-12-08 09:30:07 +01:00
|
|
|
|
|
|
|
$a = new \App\Models\Address();
|
|
|
|
$a->address_street = $cinema['cinema_address']['address_line_1'];
|
|
|
|
$a->address_city = $cinema['cinema_address']['address_city'];
|
|
|
|
$a->address_state = $cinema['cinema_address']['address_state'];
|
|
|
|
$a->address_zip = $cinema['cinema_address']['address_zip'];
|
|
|
|
$a->address_phone = $cinema['cinema_address']['address_phone'];
|
|
|
|
$a->save();
|
|
|
|
|
|
|
|
$c->address_id = $a->address_id;
|
|
|
|
$c->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|