48 lines
923 B
PHP
48 lines
923 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class PromoCodeRedemption extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'promo_code_id',
|
|
'user_id',
|
|
'redeemed_at',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'redeemed_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Get the promo code that owns the redemption.
|
|
*/
|
|
public function promoCode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PromoCode::class);
|
|
}
|
|
|
|
/**
|
|
* Get the user that owns the redemption.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
} |