64 lines
1.8 KiB
PHP
64 lines
1.8 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Modules\Frontend\Database\Seeders;
|
||
|
|
|
||
|
|
use Illuminate\Database\Seeder;
|
||
|
|
use Modules\Frontend\Models\Coupon;
|
||
|
|
|
||
|
|
class CouponSeeder extends Seeder
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Run the database seeds.
|
||
|
|
*/
|
||
|
|
public function run(): void
|
||
|
|
{
|
||
|
|
// Percentage coupon
|
||
|
|
Coupon::create([
|
||
|
|
'restaurant_id' => 1,
|
||
|
|
'name' => '10% OFF',
|
||
|
|
'discount_type' => 'percentage',
|
||
|
|
'coupon_type' => 'restaurant',
|
||
|
|
'amount' => 10, // 10%
|
||
|
|
'valid_from' => now(),
|
||
|
|
'valid_to' => now()->addMonth(),
|
||
|
|
'usage_limit' => 100,
|
||
|
|
'max_uses_per_customer' => 1,
|
||
|
|
'min_order_amount' => 500,
|
||
|
|
'status' => 1,
|
||
|
|
'source' => 'local',
|
||
|
|
]);
|
||
|
|
|
||
|
|
// Fixed coupon
|
||
|
|
Coupon::create([
|
||
|
|
'restaurant_id' => 1,
|
||
|
|
'name' => '50 BDT OFF',
|
||
|
|
'discount_type' => 'fixed',
|
||
|
|
'coupon_type' => 'restaurant',
|
||
|
|
'amount' => 50, // Fixed amount
|
||
|
|
'valid_from' => now(),
|
||
|
|
'valid_to' => now()->addMonth(),
|
||
|
|
'usage_limit' => 100,
|
||
|
|
'max_uses_per_customer' => 1,
|
||
|
|
'min_order_amount' => 200,
|
||
|
|
'status' => 1,
|
||
|
|
'source' => 'local',
|
||
|
|
]);
|
||
|
|
|
||
|
|
// Both type coupon
|
||
|
|
Coupon::create([
|
||
|
|
'restaurant_id' => 1,
|
||
|
|
'name' => 'Special Both Coupon',
|
||
|
|
'discount_type' => 'fixed',
|
||
|
|
'coupon_type' => 'both', // usable for restaurant & hotel
|
||
|
|
'amount' => 100, // Fixed amount
|
||
|
|
'valid_from' => now(),
|
||
|
|
'valid_to' => now()->addMonth(),
|
||
|
|
'usage_limit' => 50,
|
||
|
|
'max_uses_per_customer' => 1,
|
||
|
|
'min_order_amount' => 500,
|
||
|
|
'status' => 1,
|
||
|
|
'source' => 'local',
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|