6
0
Fork 0
jiqu-library-server/app/Models/ProductGift.php

39 lines
604 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ProductGift extends Model
{
/**
* @var array
*/
protected $fillable = [
'sku_id',
'gift_sku_id',
'limit',
'num',
'sent',
'remaining',
];
/**
* 赠送的商品 SKU
*/
public function giftSku()
{
return $this->belongsTo(ProductSku::class, 'gift_sku_id');
}
/**
* 确认此赠品是否有限制
*
* @return bool
*/
public function isLimit(): bool
{
return $this->limit !== 0;
}
}