<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Coupon extends Model { public const DISCOUNT_TYPE = [ 'fixed' => 'Fixed', 'percentage' => 'Percentage', ]; protected $fillable = [ 'code', 'discount_type', 'discount_value', 'expiry_date', 'number_of_usage', 'redemption_count', 'status', ]; protected $dates = [ 'created_at', 'updated_at', 'expiry_date', ]; protected $casts = [ 'created_at' => 'date:m-d-Y', 'updated_at' => 'date:m-d-Y', 'expiry_date' => 'date:m-d-Y', ]; public const STATUS_RADIO = [ '1' => 'Enabled', '0' => 'Disabled', ]; protected function getStatusNameAttribute() { return self::STATUS_RADIO[$this->status]; } }