where('dispatch_type_id', $dispatch_type_id); } public static function relationSave($dispatchType, $data) { $set = self::byDispatchTypeId($dispatchType->id)->first(); if (is_null($set)) { $set = new self(); $data = array_merge(['enable'=> $dispatchType->enable, 'sort'=> $dispatchType->sort], $data); } $data['dispatch_type_id'] = $dispatchType->id; $data['uniacid'] = \YunShop::app()->uniacid; $set->fill($data); if ($set->save()) { return true; } return false; } public static function boot() { parent::boot(); // TODO: Change the autogenerated stub self::addGlobalScope(function(Builder $query){ return $query->uniacid(); }); } }