/**
  * Pass view binding methods to the ViewBinder instance
  *
  * @param string $methodName The called method name
  * @param array $arguments The called method arguments
  *
  * @return mixed The return value from the ViewBinder method
  *
  * @throws \BadMethodCallException If the method does not exist in the
  * ViewBinder instance
  */
 public function __call($methodName, $arguments)
 {
     $method = DynamicMethod::load($methodName);
     if ($method->existsOn($this->viewBinder)) {
         return $method->callOn($this->viewBinder, $arguments);
     }
     return parent::__call($methodName, $arguments);
 }
Exemplo n.º 2
0
 /**
  * Proxy dynamic method calls to criteria methods
  *
  * @param string $methodName The called method name
  * @param array  $arguments  The called method arguments
  *
  * @return $this|null The current Repository instance for method chaining
  *
  * @throws \BadMethodCallException If the method does not exist in the
  * repository
  */
 public function __call($methodName, array $arguments)
 {
     $method = DynamicMethod::load($methodName)->append('Criterion');
     if ($method->existsOn($this)) {
         return $this->addCriterion($method, $arguments);
     }
     $method->pop()->append('Criteria');
     if ($method->existsOn($this)) {
         return $this->addCriterion($method, $arguments);
     }
     $className = get_class($this);
     $method->throwException("The criterion method [{$method}Criterion] does not exist on " . "{$className}.");
 }