Illuminate\Database\Eloquent\Builder::withGlobalScope PHP Метод

withGlobalScope() публичный Метод

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

Usage Example

Пример #1
-1
 /**
  * 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);
 }