70 lines
2 KiB
PHP
70 lines
2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Coupon
|
|
*
|
|
* @property int $id
|
|
* @property int $payment_option_id
|
|
* @property string $code
|
|
* @property float $value
|
|
* @property int|null $on_redeem_expire
|
|
* @property int|null $is_expired
|
|
* @property Carbon|null $valid_until_date
|
|
* @property PaymentOption $payment_option
|
|
* @property Collection|UserPaymentOption[] $user_payment_options
|
|
* @package App\Models
|
|
* @property-read int|null $user_payment_options_count
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon whereCode($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon whereIsExpired($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon whereOnRedeemExpire($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon wherePaymentOptionId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon whereValidUntilDate($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Coupon whereValue($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Coupon extends Model
|
|
{
|
|
protected $table = 'coupon';
|
|
public $timestamps = false;
|
|
|
|
protected $casts = [
|
|
'payment_option_id' => 'int',
|
|
'value' => 'float',
|
|
'on_redeem_expire' => 'int',
|
|
'is_expired' => 'int',
|
|
'valid_until_date' => 'datetime'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'payment_option_id',
|
|
'code',
|
|
'value',
|
|
'on_redeem_expire',
|
|
'is_expired',
|
|
'valid_until_date'
|
|
];
|
|
|
|
public function payment_option()
|
|
{
|
|
return $this->belongsTo(PaymentOption::class);
|
|
}
|
|
|
|
public function user_payment_options()
|
|
{
|
|
return $this->hasMany(UserPaymentOption::class);
|
|
}
|
|
}
|