🚀 Hostinger Optimized
🖥️ Server: LiteSpeed
💻 System: Linux s20058.bom1.stableserver.net 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64
👤 User: skhata (1324)
🐘 PHP: 8.4.20
🚫 Disabled: ✨ NONE

💻 Terminal

📁 /home/skhata/chandrasons.com/public
$

📄 OrderFactory.php

📁 Path: /home/skhata/new.chandrapharma.com/database/factories/OrderFactory.php
📊 Size: 2.29 KB
🔒 Perm: 0644
📝 MIME: text/x-php
<?php

namespace Database\Factories;

use App\Modules\Order\Models\Order;
use App\Modules\User\Models\User;
use App\Modules\Vendor\Models\Vendor;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class OrderFactory extends Factory
{
    protected $model = Order::class;

    public function definition(): array
    {
        $subtotal = fake()->randomFloat(2, 200, 5000);

        return [
            'order_number'   => 'STP-' . now()->format('Ymd') . '-' . strtoupper(Str::random(5)),
            'uuid'           => (string) Str::uuid(),
            'user_id'        => User::factory(),
            'vendor_id'      => Vendor::factory(),
            'shipping_address' => [
                'name'    => fake()->name(),
                'phone'   => '98' . fake()->numerify('########'),
                'city'    => 'Kathmandu',
                'country' => 'Nepal',
            ],
            'currency'        => 'NPR',
            'subtotal'        => $subtotal,
            'discount_amount' => 0,
            'coupon_discount' => 0,
            'shipping_amount' => 100,
            'tax_amount'      => round($subtotal * 0.13, 2),
            'total_amount'    => $subtotal + 100 + round($subtotal * 0.13, 2),
            'status'          => 'pending',
            'payment_method'  => 'cod',
            'payment_status'  => 'pending',
            'vendor_payout_amount' => round($subtotal * 0.9, 2),
            'payout_processed'     => false,
        ];
    }

    public function delivered(): static
    {
        return $this->state([
            'status'       => 'delivered',
            'delivered_at' => now()->subDays(2),
        ]);
    }

    public function cancelled(): static
    {
        return $this->state([
            'status'       => 'cancelled',
            'cancelled_at' => now()->subDay(),
        ]);
    }

    public function returned(): static
    {
        return $this->state([
            'status'       => 'returned',
            'delivered_at' => now()->subDays(3),
        ]);
    }

    public function refunded(): static
    {
        return $this->state(['status' => 'refunded']);
    }

    public function paid(): static
    {
        return $this->state([
            'payment_status' => 'paid',
            'paid_at'        => now()->subHour(),
        ]);
    }
}
← Back📥 Raw✏️ Edit🔒 Chmod
✨ File Manager Magic ✨