163 lines
5.3 KiB
PHP
163 lines
5.3 KiB
PHP
<?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, // Mon–Thu, 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(),
|
||
]
|
||
));
|
||
}
|
||
}
|
||
}
|