Viewing file: OrderSeeder.php (5.18 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder; use App\Models\CallWaiter; use App\Models\Order; use App\Models\OrderDetails; use Illuminate\Support\Str; use Illuminate\Support\Carbon; class OrderSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $waiter = [ [ 'user_id' => 1, 'restaurant_id' => 1, 'table_id' => 1, 'status' => 'pending', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'user_id' => 1, 'restaurant_id' => 1, 'table_id' => 2, 'status' => 'pending', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'user_id' => 1, 'restaurant_id' => 1, 'table_id' => 3, 'status' => 'pending', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], ];
CallWaiter::insert($waiter);
$order = [ [ 'user_id' => 2, 'name' => 'walk_in_customer', 'restaurant_id' => 1, 'email' => 'alex@gmail.com', 'total_price' => 38.9405, 'status' => 'approved', 'type' => 'pos', 'payment_status' => 'paid', 'comment' => 'Blanditiis laborum o', 'order_number' => 32352322, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'user_id' => 2, 'name' => 'walk_in_customer', 'restaurant_id' => 1, 'email' => 'alex@gmail.com', 'total_price' => 38.9405, 'status' => 'approved', 'type' => 'pos', 'payment_status' => 'paid', 'comment' => 'Blanditiis laborum o', 'order_number' => 34300393, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'user_id' => 2, 'name' => 'Alex Johnson', 'restaurant_id' => 1, 'email' => 'alex@gmail.com', 'total_price' => 38.9405, 'status' => 'pending', 'type' => 'pos', 'payment_status' => 'unpaid', 'comment' => 'Blanditiis laborum o', 'order_number' => 78378567, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ] ];
Order::insert($order);
$orderDetails = [ [ 'order_id' => 1, 'item_id' => 1, 'price' => 10.99, 'quantity' => 1, 'total' => 12.4405, 'status' => 'approved', 'discount' => 0.5495, 'tax_amount' => 2, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'order_id' => 1, 'item_id' => 2, 'price' => 12.5, 'quantity' => 1, 'total' => 14.5, 'status' => 'approved', 'discount' => 0, 'tax_amount' => 2, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'order_id' => 2, 'item_id' => 1, 'price' => 10.99, 'quantity' => 1, 'total' => 12.4405, 'status' => 'approved', 'discount' => 0.5495, 'tax_amount' => 2, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'order_id' => 2, 'item_id' => 2, 'price' => 12.5, 'quantity' => 1, 'total' => 14.5, 'status' => 'approved', 'discount' => 0, 'tax_amount' => 2, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'order_id' => 3, 'item_id' => 1, 'price' => 10.99, 'quantity' => 1, 'total' => 12.4405, 'status' => 'approved', 'discount' => 0.5495, 'tax_amount' => 2, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], [ 'order_id' => 3, 'item_id' => 2, 'price' => 12.5, 'quantity' => 1, 'total' => 14.5, 'status' => 'approved', 'discount' => 0, 'tax_amount' => 2, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ], ]; OrderDetails::insert($orderDetails); } }
|