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

__call() public method

Dynamically handle calls into the query instance.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
    public function __call($method, $parameters)
    {
        if (isset($this->macros[$method])) {
            array_unshift($parameters, $this);
            return call_user_func_array($this->macros[$method], $parameters);
        }
        if (method_exists($this->model, $scope = 'scope' . ucfirst($method))) {
            return $this->callScope([$this->model, $scope], $parameters);
        }
        if (in_array($method, $this->passthru)) {
            return call_user_func_array([$this->toBase(), $method], $parameters);
        }
        call_user_func_array([$this->query, $method], $parameters);
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Dynamically handle calls into the query instance.
  * @param  string  $method
  * @param  array   $parameters
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     if ($this->model->methodExists($scope = 'scope' . ucfirst($method))) {
         return $this->callScope($scope, $parameters);
     }
     return parent::__call($method, $parameters);
 }
All Usage Examples Of Illuminate\Database\Eloquent\Builder::__call