public function withGlobalScope($identifier, $scope) { $this->scopes[$identifier] = $scope; if (method_exists($scope, 'extend')) { $scope->extend($this); } return $this; }
/** * Register a new global scope. * * @param string $identifier * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope * @return $this * @static */ public static function withGlobalScope($identifier, $scope) { return \Illuminate\Database\Eloquent\Builder::withGlobalScope($identifier, $scope); }