migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace Modules\RestaurantDelivery\Database\Seeders;
use Illuminate\Database\Seeder;
class RestaurantDeliveryDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$this->call([
RestaurantDeliveryZoneSeeder::class,
RestaurantRiderSeeder::class,
RestaurantZonePricingRuleSeeder::class,
RestaurantDeliverySeeder::class,
]);
}
}

View File

@@ -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(),
]
));
}
}
}

View File

@@ -0,0 +1,134 @@
<?php
namespace Modules\RestaurantDelivery\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class RestaurantDeliveryZoneSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$zones = [
[
'restaurant_id' => 1,
'uuid' => Str::uuid(),
'name' => 'Dhanmondi Zone',
'slug' => 'dhanmondi-zone',
'description' => 'Delivery zone covering Dhanmondi area',
'color' => '#3B82F6',
'coordinates' => json_encode([
[23.7461, 90.3742],
[23.7485, 90.3810],
[23.7428, 90.3852],
[23.7395, 90.3770],
[23.7461, 90.3742],
]),
'min_lat' => 23.7395,
'max_lat' => 23.7485,
'min_lng' => 90.3742,
'max_lng' => 90.3852,
'priority' => 1,
'is_active' => true,
'is_default' => true,
'max_delivery_distance' => 5.00,
'operating_hours' => json_encode([
'open' => '10:00',
'close' => '23:00',
]),
],
[
'restaurant_id' => 1,
'uuid' => Str::uuid(),
'name' => 'Gulshan Zone',
'slug' => 'gulshan-zone',
'description' => 'Delivery zone covering Gulshan area',
'color' => '#22C55E',
'coordinates' => json_encode([
[23.7930, 90.4043],
[23.7965, 90.4108],
[23.7892, 90.4151],
[23.7850, 90.4082],
[23.7930, 90.4043],
]),
'min_lat' => 23.7850,
'max_lat' => 23.7965,
'min_lng' => 90.4043,
'max_lng' => 90.4151,
'priority' => 2,
'is_active' => true,
'is_default' => false,
'max_delivery_distance' => 6.00,
'operating_hours' => json_encode([
'open' => '09:00',
'close' => '22:30',
]),
],
[
'restaurant_id' => 1,
'uuid' => Str::uuid(),
'name' => 'Mirpur Zone',
'slug' => 'mirpur-zone',
'description' => 'Delivery zone covering Mirpur area',
'color' => '#F97316',
'coordinates' => json_encode([
[23.8223, 90.3654],
[23.8280, 90.3725],
[23.8190, 90.3780],
[23.8135, 90.3698],
[23.8223, 90.3654],
]),
'min_lat' => 23.8135,
'max_lat' => 23.8280,
'min_lng' => 90.3654,
'max_lng' => 90.3780,
'priority' => 3,
'is_active' => true,
'is_default' => false,
'max_delivery_distance' => 7.00,
'operating_hours' => json_encode([
'open' => '10:00',
'close' => '22:00',
]),
],
[
'restaurant_id' => 1,
'uuid' => Str::uuid(),
'name' => 'Uttara Zone',
'slug' => 'uttara-zone',
'description' => 'Delivery zone covering Uttara area',
'color' => '#A855F7',
'coordinates' => json_encode([
[23.8759, 90.3795],
[23.8812, 90.3878],
[23.8720, 90.3932],
[23.8671, 90.3841],
[23.8759, 90.3795],
]),
'min_lat' => 23.8671,
'max_lat' => 23.8812,
'min_lng' => 90.3795,
'max_lng' => 90.3932,
'priority' => 4,
'is_active' => true,
'is_default' => false,
'max_delivery_distance' => 8.00,
'operating_hours' => json_encode([
'open' => '09:30',
'close' => '23:30',
]),
],
];
foreach ($zones as $zone) {
DB::table('restaurant_delivery_zones')->insert(array_merge($zone, [
'created_at' => now(),
'updated_at' => now(),
]));
}
}
}

View File

@@ -0,0 +1,211 @@
<?php
namespace Modules\RestaurantDelivery\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class RestaurantRiderSeeder extends Seeder
{
public function run(): void
{
$riders = [
// ======================
// Rider 1 Motorcycle (Active)
// ======================
[
'uuid' => Str::uuid(),
'restaurant_id' => 1,
'user_id' => 23,
'first_name' => 'Rakib',
'last_name' => 'Hossain',
'phone' => '01710000001',
'email' => 'rakib.rider@gmail.com',
'photo' => null,
'date_of_birth' => '1998-04-15',
'national_id' => '19982654789012345',
'emergency_contact' => '01790000001',
'type' => 'freelance',
'status' => 'active',
'vehicle_type' => 'motorcycle',
'vehicle_number' => 'DHAKA-METRO-LA-123456',
'vehicle_model' => 'Bajaj Discover 125',
'vehicle_color' => 'Black',
'license_number' => 'DL-45879632',
'license_expiry' => '2027-06-30',
'is_verified' => true,
'verified_at' => now(),
'verified_by' => 'admin',
'verification_documents' => json_encode([
'nid' => 'nid_rakib.jpg',
'license' => 'license_rakib.jpg',
]),
'commission_type' => 'percentage',
'commission_rate' => 70,
'current_latitude' => 23.7461,
'current_longitude' => 90.3742,
'last_location_update' => now(),
'rating' => 4.85,
'rating_count' => 124,
'total_deliveries' => 320,
'successful_deliveries' => 305,
'cancelled_deliveries' => 10,
'failed_deliveries' => 5,
'acceptance_rate' => 95.00,
'completion_rate' => 96.50,
'is_online' => true,
'last_online_at' => now(),
'bank_name' => 'bKash',
'mobile_wallet_provider' => 'bKash',
'mobile_wallet_number' => '01710000001',
'assigned_zones' => json_encode([1, 2]),
'meta' => json_encode(['shift' => 'day']),
],
// ======================
// Rider 2 Bicycle (Budget)
// ======================
[
'uuid' => Str::uuid(),
'restaurant_id' => 1,
'user_id' => 24,
'first_name' => 'Sajid',
'last_name' => 'Ahmed',
'phone' => '01820000002',
'email' => null,
'type' => 'freelance',
'status' => 'active',
'vehicle_type' => 'bicycle',
'is_verified' => true,
'verified_at' => now(),
'verified_by' => 'admin',
'commission_type' => 'fixed',
'commission_rate' => 50,
'current_latitude' => 23.8223,
'current_longitude' => 90.3654,
'last_location_update' => now(),
'rating' => 4.60,
'rating_count' => 52,
'total_deliveries' => 140,
'successful_deliveries' => 135,
'cancelled_deliveries' => 3,
'failed_deliveries' => 2,
'is_online' => true,
'last_online_at' => now(),
'assigned_zones' => json_encode([3]),
'meta' => json_encode(['shift' => 'morning']),
],
// ======================
// Rider 3 Car (Premium / Gulshan)
// ======================
[
'uuid' => Str::uuid(),
'restaurant_id' => 1,
'user_id' => null,
'first_name' => 'Mahmud',
'last_name' => 'Khan',
'phone' => '01930000003',
'email' => 'mahmud.khan@gmail.com',
'type' => 'internal',
'status' => 'active',
'vehicle_type' => 'car',
'vehicle_number' => 'DHAKA-METRO-GA-987654',
'vehicle_model' => 'Toyota Axio',
'vehicle_color' => 'White',
'is_verified' => true,
'verified_at' => now(),
'verified_by' => 'super_admin',
'commission_type' => 'hybrid',
'commission_rate' => 60,
'base_commission' => 40,
'per_km_rate' => 6,
'current_latitude' => 23.7930,
'current_longitude' => 90.4043,
'last_location_update' => now(),
'rating' => 4.95,
'rating_count' => 210,
'total_deliveries' => 410,
'successful_deliveries' => 405,
'is_online' => false,
'went_offline_at' => now()->subHours(2),
'bank_name' => 'Dutch Bangla Bank',
'bank_account_name' => 'Mahmud Khan',
'bank_account_number' => '1234567890',
'assigned_zones' => json_encode([2, 4]),
'meta' => json_encode(['vehicle_class' => 'premium']),
],
// ======================
// Rider 4 Pending Verification
// ======================
[
'uuid' => Str::uuid(),
'restaurant_id' => 1,
'user_id' => null,
'first_name' => 'Arif',
'last_name' => 'Hasan',
'phone' => '01640000004',
'type' => 'third_party',
'status' => 'pending',
'vehicle_type' => 'motorcycle',
'is_verified' => false,
'commission_type' => 'percentage',
'commission_rate' => 65,
'rating' => 5.00,
'rating_count' => 0,
'is_online' => false,
'assigned_zones' => json_encode([1]),
'meta' => json_encode(['note' => 'Awaiting documents']),
],
];
foreach ($riders as $rider) {
DB::table('restaurant_riders')->insert(array_merge(
$rider,
[
'created_at' => now(),
'updated_at' => now(),
]
));
}
}
}

View File

@@ -0,0 +1,162 @@
<?php
namespace Modules\RestaurantDelivery\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class RestaurantZonePricingRuleSeeder extends Seeder
{
public function run(): void
{
$rules = [
// =========================
// Dhanmondi Zone (Zone ID 1)
// =========================
[
'restaurant_id' => 1,
'zone_id' => 1,
'uuid' => Str::uuid(),
'name' => 'Dhanmondi Standard Pricing',
'priority' => 1,
'is_active' => true,
'base_fare' => 30,
'minimum_fare' => 30,
'per_km_charge' => 8,
'free_distance' => 1,
'max_distance' => 8,
'surge_enabled' => false,
'surge_multiplier' => 1.00,
'conditions' => null,
'valid_from' => null,
'valid_until' => null,
'valid_days' => null,
],
[
'restaurant_id' => 1,
'zone_id' => 1,
'uuid' => Str::uuid(),
'name' => 'Dhanmondi Peak Hour Surge',
'priority' => 2,
'is_active' => true,
'base_fare' => 35,
'minimum_fare' => 40,
'per_km_charge' => 9,
'free_distance' => 0,
'max_distance' => null,
'surge_enabled' => true,
'surge_multiplier' => 1.30,
'conditions' => json_encode([
'type' => 'peak_hour',
'note' => 'Evening rush',
]),
'valid_from' => '18:00:00',
'valid_until' => '22:00:00',
'valid_days' => 62, // MonThu, Sun
],
// ======================
// Gulshan Zone (Zone ID 2)
// ======================
[
'restaurant_id' => 1,
'zone_id' => 2,
'uuid' => Str::uuid(),
'name' => 'Gulshan Standard Pricing',
'priority' => 1,
'is_active' => true,
'base_fare' => 40,
'minimum_fare' => 50,
'per_km_charge' => 12,
'free_distance' => 0,
'max_distance' => 10,
'surge_enabled' => false,
'surge_multiplier' => 1.00,
'conditions' => null,
'valid_from' => null,
'valid_until' => null,
'valid_days' => null,
],
[
'restaurant_id' => 1,
'zone_id' => 2,
'uuid' => Str::uuid(),
'name' => 'Gulshan Weekend Surge',
'priority' => 2,
'is_active' => true,
'base_fare' => 45,
'minimum_fare' => 60,
'per_km_charge' => 14,
'free_distance' => 0,
'max_distance' => null,
'surge_enabled' => true,
'surge_multiplier' => 1.50,
'conditions' => json_encode([
'type' => 'weekend',
'note' => 'Friday & Saturday',
]),
'valid_from' => '12:00:00',
'valid_until' => '23:59:59',
'valid_days' => 96, // Fri + Sat
],
// ======================
// Mirpur Zone (Zone ID 3)
// ======================
[
'restaurant_id' => 1,
'zone_id' => 3,
'uuid' => Str::uuid(),
'name' => 'Mirpur Budget Pricing',
'priority' => 1,
'is_active' => true,
'base_fare' => 25,
'minimum_fare' => 30,
'per_km_charge' => 7,
'free_distance' => 1.5,
'max_distance' => 7,
'surge_enabled' => false,
'surge_multiplier' => 1.00,
'conditions' => null,
'valid_from' => null,
'valid_until' => null,
'valid_days' => null,
],
// ======================
// Uttara Zone (Zone ID 4)
// ======================
[
'restaurant_id' => 1,
'zone_id' => 4,
'uuid' => Str::uuid(),
'name' => 'Uttara Long Distance Pricing',
'priority' => 1,
'is_active' => true,
'base_fare' => 35,
'minimum_fare' => 40,
'per_km_charge' => 9,
'free_distance' => 1,
'max_distance' => 12,
'surge_enabled' => false,
'surge_multiplier' => 1.00,
'conditions' => null,
'valid_from' => null,
'valid_until' => null,
'valid_days' => null,
],
];
foreach ($rules as $rule) {
DB::table('restaurant_zone_pricing_rules')->insert(array_merge(
$rule,
[
'created_at' => now(),
'updated_at' => now(),
]
));
}
}
}