1, 'is_automatic' => 0, 'serviceFee' => 0, ]; public $timestamps = false; protected $guarded = []; public function scopeOfGoodsId($query, $goodsId) { return $query->where('goods_id', $goodsId); } /** * 初始化方法 */ public static function boot() { parent::boot(); // 添加了公众号id的全局条件. static::addGlobalScope(function ($builder) { $builder->uniacid(); }); } }