12345678910111213141516171819202122232425 |
- <?php
- namespace app\common\model;
- use think\Db;
- use think\Model;
- class Favourite extends Model
- {
- protected $type=[
- 'tax'=>'json',
- ];
- protected $autoWriteTimestamp=true;
- protected $updateTime=null;
- protected $createTime='created_at';
- public function goods(){
- return $this->belongsTo(Goods::class,'fav_id');
- }
- public static function delNotExists(){
- self::whereNotExists(GoodsSku::where('id',Db::raw('favourite.goods_sku_id'))->buildSql())->delete();
- }
- }
|