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

📄 2024_02_01_000001_create_coupons_table.php

📁 Path: //home/skhata/new.chandrapharma.com/database/migrations/2024_02_01_000001_create_coupons_table.php
📊 Size: 1.45 KB
🔒 Perm: 0644
📝 MIME: text/x-php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('coupons', function (Blueprint $table) {
            $table->id();
            $table->string('code')->unique();
            $table->enum('type', ['flat', 'percent', 'free_ship'])->default('flat');
            $table->decimal('value', 10, 2);                        // Amount or percent value
            $table->decimal('max_discount', 10, 2)->nullable();     // Cap for percent type
            $table->decimal('min_order', 10, 2)->nullable();        // Minimum cart subtotal
            $table->unsignedInteger('max_uses')->nullable();         // Global usage cap
            $table->unsignedInteger('used_count')->default(0);
            $table->foreignId('vendor_id')->nullable()->constrained('vendors')->nullOnDelete();
            $table->json('conditions')->nullable();                  // Reserved: product/category restrictions
            $table->string('description')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamp('starts_at')->nullable();
            $table->timestamp('expires_at')->nullable();
            $table->timestamps();

            $table->index(['code', 'is_active']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('coupons');
    }
};
← Back📥 Raw✏️ Edit🔒 Chmod
✨ File Manager Magic ✨