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

__call() public method

Handle dynamic method calls into the method.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
    public function __call($method, $parameters)
    {
        if (static::hasMacro($method)) {
            return $this->macroCall($method, $parameters);
        }
        if (Str::startsWith($method, 'where')) {
            return $this->dynamicWhere($method, $parameters);
        }
        $className = static::class;
        throw new BadMethodCallException("Call to undefined method {$className}::{$method}()");
    }

Usage Example

Beispiel #1
0
 /**
  * Handle dynamic method calls into the method.
  *
  * @param  string  $method
  * @param  array   $parameters
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     if ($method == 'unset') {
         return call_user_func_array(array($this, 'drop'), $parameters);
     }
     return parent::__call($method, $parameters);
 }