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

__call() public method

Handle dynamic method calls into the model.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed
    public function __call($method, $parameters)
    {
        if (in_array($method, ['increment', 'decrement'])) {
            return call_user_func_array([$this, $method], $parameters);
        }
        $query = $this->newQuery();
        return call_user_func_array([$query, $method], $parameters);
    }

Usage Example

Example #1
0
 /**
  * Handle polyglot dynamic method calls for locale relations.
  *
  * @param  string $method
  * @param  array  $parameters
  *
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     // If the model supports the locale, load it
     if (in_array($method, $this->getAvailable())) {
         return $this->hasOne($this->getLangClass())->whereLang($method);
     }
     return parent::__call($method, $parameters);
 }
All Usage Examples Of Illuminate\Database\Eloquent\Model::__call
Model