migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\RestaurantDelivery\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Restaurant\Models\Order;
|
||||
|
||||
class RestaurantDeliverySeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$deliveries = [
|
||||
|
||||
// =========================
|
||||
// Delivery 1 – In Progress
|
||||
// =========================
|
||||
[
|
||||
'uuid' => Str::uuid(),
|
||||
'tracking_code' => 'TRKBD10001',
|
||||
'restaurant_id' => 1,
|
||||
'rider_id' => 1,
|
||||
'zone_id' => 1,
|
||||
|
||||
// Polymorphic order
|
||||
'orderable_id' => 10,
|
||||
'orderable_type' => Order::class,
|
||||
|
||||
'status' => 'on_the_way',
|
||||
'previous_status' => 'picked_up',
|
||||
'status_changed_at' => now()->subMinutes(5),
|
||||
|
||||
'restaurant_name' => 'Kacchi Bhai Dhanmondi',
|
||||
'pickup_address' => 'Dhanmondi 32, Dhaka',
|
||||
'pickup_latitude' => 23.7461,
|
||||
'pickup_longitude' => 90.3742,
|
||||
'pickup_contact_name' => 'Restaurant Manager',
|
||||
'pickup_contact_phone' => '01711000000',
|
||||
|
||||
'customer_name' => 'Rahim Uddin',
|
||||
'drop_address' => 'Gulshan 1, Dhaka',
|
||||
'drop_latitude' => 23.7930,
|
||||
'drop_longitude' => 90.4043,
|
||||
'drop_contact_name' => 'Rahim',
|
||||
'drop_contact_phone' => '01819000000',
|
||||
'drop_floor' => '5th',
|
||||
'drop_apartment' => 'A5',
|
||||
|
||||
'distance' => 5.8,
|
||||
'estimated_duration' => 28,
|
||||
|
||||
'base_fare' => 30,
|
||||
'distance_charge' => 46.4,
|
||||
'surge_charge' => 0,
|
||||
'total_delivery_charge' => 76.4,
|
||||
'charge_breakdown' => json_encode([
|
||||
'base' => 30,
|
||||
'distance' => 46.4,
|
||||
]),
|
||||
|
||||
'order_value' => 850,
|
||||
|
||||
'rider_assigned_at' => now()->subMinutes(25),
|
||||
'picked_up_at' => now()->subMinutes(10),
|
||||
'on_the_way_at' => now()->subMinutes(5),
|
||||
|
||||
'assignment_attempts' => 1,
|
||||
|
||||
'meta' => json_encode([
|
||||
'payment_mode' => 'cod',
|
||||
]),
|
||||
],
|
||||
|
||||
// =========================
|
||||
// Delivery 2 – Delivered
|
||||
// =========================
|
||||
[
|
||||
'uuid' => Str::uuid(),
|
||||
'tracking_code' => 'TRKBD10002',
|
||||
'restaurant_id' => 1,
|
||||
'rider_id' => 2,
|
||||
'zone_id' => 2,
|
||||
|
||||
'orderable_id' => 11,
|
||||
'orderable_type' => Order::class,
|
||||
|
||||
'status' => 'delivered',
|
||||
'previous_status' => 'arrived',
|
||||
'status_changed_at' => now()->subMinutes(2),
|
||||
|
||||
'restaurant_name' => 'Pizza Roma Gulshan',
|
||||
'pickup_address' => 'Gulshan 2 Circle, Dhaka',
|
||||
'pickup_latitude' => 23.7937,
|
||||
'pickup_longitude' => 90.4066,
|
||||
|
||||
'customer_name' => 'Karim Ahmed',
|
||||
'drop_address' => 'Banani DOHS, Dhaka',
|
||||
'drop_latitude' => 23.8103,
|
||||
'drop_longitude' => 90.4125,
|
||||
'drop_contact_phone' => '01715000000',
|
||||
|
||||
'distance' => 4.2,
|
||||
'estimated_duration' => 22,
|
||||
|
||||
'base_fare' => 40,
|
||||
'distance_charge' => 50.4,
|
||||
'surge_charge' => 15,
|
||||
'surge_multiplier' => 1.3,
|
||||
'total_delivery_charge' => 105.4,
|
||||
|
||||
'tip_amount' => 50,
|
||||
'tip_type' => 'post_delivery',
|
||||
'tip_paid_at' => now(),
|
||||
|
||||
'order_value' => 1200,
|
||||
|
||||
'rider_assigned_at' => now()->subMinutes(40),
|
||||
'picked_up_at' => now()->subMinutes(25),
|
||||
'delivered_at' => now()->subMinutes(2),
|
||||
|
||||
'delivery_photo' => 'deliveries/proof_10002.jpg',
|
||||
'recipient_name' => 'Karim Ahmed',
|
||||
|
||||
'customer_notified' => true,
|
||||
|
||||
'assignment_attempts' => 1,
|
||||
],
|
||||
|
||||
// =========================
|
||||
// Delivery 3 – Cancelled
|
||||
// =========================
|
||||
[
|
||||
'uuid' => Str::uuid(),
|
||||
'tracking_code' => 'TRKBD10003',
|
||||
'restaurant_id' => 1,
|
||||
'rider_id' => null,
|
||||
'zone_id' => 3,
|
||||
|
||||
'orderable_id' => 12,
|
||||
'orderable_type' => Order::class,
|
||||
|
||||
'status' => 'cancelled',
|
||||
'previous_status' => 'pending',
|
||||
'status_changed_at' => now()->subMinutes(15),
|
||||
|
||||
'restaurant_name' => 'Burger Express Mirpur',
|
||||
'pickup_address' => 'Mirpur 10, Dhaka',
|
||||
'pickup_latitude' => 23.8223,
|
||||
'pickup_longitude' => 90.3654,
|
||||
|
||||
'customer_name' => 'Sabbir Khan',
|
||||
'drop_address' => 'Mirpur 11, Dhaka',
|
||||
'drop_latitude' => 23.8300,
|
||||
'drop_longitude' => 90.3600,
|
||||
|
||||
'order_value' => 420,
|
||||
|
||||
'cancellation_reason' => 'Customer requested cancellation',
|
||||
'cancelled_by' => 'customer',
|
||||
'cancelled_at' => now()->subMinutes(15),
|
||||
|
||||
'assignment_attempts' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($deliveries as $delivery) {
|
||||
DB::table('restaurant_deliveries')->insert(array_merge(
|
||||
$delivery,
|
||||
[
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user