Ejemplo n.º 1
0
 /**
  * Dynamically append actions to the block
  *
  * @param string $method     The method
  * @param array  $parameters Its parameters
  *
  * @return Actions
  */
 public function __call($method, $parameters)
 {
     // Dynamically add buttons to an actions block
     if ($this->isButtonMethod($method)) {
         $text = array_get($parameters, 0);
         $link = array_get($parameters, 1);
         $attributes = array_get($parameters, 2);
         if (!$attributes and is_array($link)) {
             $attributes = $link;
         }
         return $this->createButtonOfType($method, $text, $link, $attributes);
     }
     return parent::__call($method, $parameters);
 }
Ejemplo n.º 2
0
 /**
  * Redirect calls to the group if necessary
  *
  * @param string $method
  */
 public function __call($method, $parameters)
 {
     // Translate attributes
     $translatable = $this->app['form']->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);
 }