Promo Codes

@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif

Discount codes applied at membership checkout.

{{-- Create form --}}

Create Promo Code

@csrf
@error('code')

{{ $message }}

@enderror
@php function promoStatus($code) { if (!$code->is_active) return ['label' => 'Inactive', 'cls' => 'bg-gray-100 text-gray-600']; $now = now(); if ($code->valid_from && \Carbon\Carbon::parse($code->valid_from)->gt($now)) return ['label' => 'Scheduled', 'cls' => 'bg-blue-100 text-blue-700']; if ($code->valid_until && \Carbon\Carbon::parse($code->valid_until)->lt($now)) return ['label' => 'Expired', 'cls' => 'bg-red-100 text-red-600']; if ($code->usage_limit && $code->used_count >= $code->usage_limit) return ['label' => 'Used up', 'cls' => 'bg-yellow-100 text-yellow-700']; return ['label' => 'Active', 'cls' => 'bg-green-100 text-green-700']; } @endphp
@if($codes->isEmpty())

No promo codes yet

Create your first code to start offering discounts to members.

@else
@foreach($codes as $code) @php $status = promoStatus($code); @endphp {{-- Inline edit row --}} @endforeach
Code Discount Usage Validity Status
{{ $code->code }} @if($code->description)

{{ $code->description }}

@endif
@if($code->discount_type === 'percent') {{ $code->discount_value }}% off @else ₹{{ $code->discount_value }} off @endif @if($code->max_discount && $code->discount_type === 'percent') max ₹{{ $code->max_discount }} @endif
{{ $code->used_count }} / {{ $code->usage_limit ?? '∞' }}
@if($code->usage_limit)
@endif
@if($code->valid_from || $code->valid_until) {{ $code->valid_from ? \Carbon\Carbon::parse($code->valid_from)->format('d M Y') : '—' }} → {{ $code->valid_until ? \Carbon\Carbon::parse($code->valid_until)->format('d M Y') : '∞' }} @else No expiry @endif {{ $status['label'] }}
@csrf @method('PATCH')
@csrf @method('DELETE')

Editing Code

@csrf @method('PATCH')
@endif
{{ $codes->withQueryString()->links() }}