🚀 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
$

📄 LoyaltyTransactionFactory.php

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

namespace Database\Factories;

use App\Modules\Promotions\Models\LoyaltyTransaction;
use App\Modules\User\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class LoyaltyTransactionFactory extends Factory
{
    protected $model = LoyaltyTransaction::class;

    public function definition(): array
    {
        $points = fake()->numberBetween(10, 500);

        return [
            'user_id'        => User::factory(),
            'type'           => 'earn',
            'points'         => $points,
            'balance_after'  => $points,
            'reference_type' => null,
            'reference_id'   => null,
            'description'    => 'Points earned',
            'expires_at'     => now()->addYear(),
        ];
    }

    public function earn(int $points = 100): static
    {
        return $this->state([
            'type'   => 'earn',
            'points' => $points,
        ]);
    }

    public function burn(int $points = 50): static
    {
        return $this->state([
            'type'   => 'burn',
            'points' => -$points,
        ]);
    }

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