Illuminate\Database\Eloquent\Builder::scopes PHP Method

scopes() public method

Add the given scopes to the current builder instance.
public scopes ( array $scopes ) : mixed
$scopes array
return mixed
    public function scopes(array $scopes)
    {
        $builder = $this;
        foreach ($scopes as $scope => $parameters) {
            if (is_int($scope)) {
                list($scope, $parameters) = [$parameters, []];
            }
            $builder = $builder->callScope([$this->model, 'scope' . ucfirst($scope)], (array) $parameters);
        }
        return $builder;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Add the given scopes to the current builder instance.
  *
  * @param array $scopes
  * @return mixed 
  * @static 
  */
 public static function scopes($scopes)
 {
     return \Illuminate\Database\Eloquent\Builder::scopes($scopes);
 }