HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/ghayatcom/ghayatcom-api/database/seeders/CouponSeeder.php
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Coupon;
use DateTime;

class CouponSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $datas = [
            1 => [
                'area_specialisation_id' => 1,
                'code' => 'TEST50',
                'value' => '50',
                'type' => '1',
                'name' => '50% Offer',
                'description' => '50% Offer for a booking',
                'status' => '1',
                'created_at' => new DateTime,
                'created_by' => 1
            ]
        ];

        foreach ($datas as $id => $data) {
            $row = Coupon::firstOrNew([
                'id' => $id,
            ]);
            $row->fill($data);
            $row->save();
        }
    }
}