Former\Traits\Field::__call PHP Method

__call() public method

Redirect calls to the group if necessary
public __call ( string $method, $parameters )
$method string
    public function __call($method, $parameters)
    {
        // Translate attributes
        $translatable = $this->app['former']->getOption('translatable', array());
        if (in_array($method, $translatable) and isset($parameters[0])) {
            $parameters[0] = Helpers::translate($parameters[0]);
        }
        // Redirect calls to the Control Group
        if (method_exists($this->group, $method) or Str::startsWith($method, 'onGroup')) {
            $method = str_replace('onGroup', '', $method);
            $method = lcfirst($method);
            call_user_func_array(array($this->group, $method), $parameters);
            return $this;
        }
        return parent::__call($method, $parameters);
    }

Usage Example

Esempio n. 1
0
 /**
  * Apply methods to focused checkable
  */
 public function __call($method, $parameters)
 {
     $focused = $this->setOnFocused('attributes.' . $method, array_get($parameters, 0));
     if ($focused) {
         return $this;
     }
     return parent::__call($method, $parameters);
 }