Viewing file: TableSeeder.php (2.79 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; class TableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $positions = [ [ 'user_id' => 2, 'name' => 'Near Window', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'name' => 'Center Hall', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'name' => 'Garden View', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'name' => 'Private Room', 'created_at' => now(), 'updated_at' => now(), ], ];
DB::table('table_positions')->insert($positions);
$tables = [ [ 'user_id' => 2, 'restaurant_id' => 1, 'name' => 'Table A1', 'no_of_capacity' => 4, 'table_position_id' => rand(1, 4), 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'restaurant_id' => 1, 'name' => 'Table A2', 'no_of_capacity' => 2, 'table_position_id' => rand(1, 4), 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'restaurant_id' => 1, 'name' => 'Table B1', 'no_of_capacity' => 6, 'table_position_id' => rand(1, 4), 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'restaurant_id' => 1, 'name' => 'Table B2', 'no_of_capacity' => 4, 'table_position_id' => rand(1, 4), 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ], [ 'user_id' => 2, 'restaurant_id' => 1, 'name' => 'Table C1', 'no_of_capacity' => 8, 'table_position_id' => rand(1, 4), 'status' => 'active', 'created_at' => now(), 'updated_at' => now(), ], ];
DB::table('tables')->insert($tables);
} }
|