Files
Skunk-Lounge/app/Models/PromoCode.php

42 lines
789 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class PromoCode extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'code',
'value',
'uses_remaining',
'expires_at',
'is_active',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'expires_at' => 'datetime',
];
/**
* Get the redemptions for the promo code.
*/
public function redemptions(): HasMany
{
return $this->hasMany(PromoCodeRedemption::class);
}
}