Skip to content

Instantly share code, notes, and snippets.

@daniellima
Created April 22, 2016 23:42
Show Gist options
  • Select an option

  • Save daniellima/ad87ff60f5c5e51dbc7b336f910bd4b8 to your computer and use it in GitHub Desktop.

Select an option

Save daniellima/ad87ff60f5c5e51dbc7b336f910bd4b8 to your computer and use it in GitHub Desktop.
Vc pode usar então {{ ProcessoController::getAddURL(1,2) }}
// Vc pode usar então {{ ProcessoController::getAddURL(1,2) }}
// e será o equivalente à {{ action('ProcessoController@getAdd', array(1, 2)) }}
// 15 caracteres a menos
// Não é possivel errar o nome do controller, e ele pode ser autocompletado
public static function __callStatic($name, $arguments)
{
if(substr($name, -3) == "URL"){
$actionName = substr($name, 0, -3);
try {
return action(get_called_class()."@".$actionName, $arguments);
} catch(Exception $ex) {
throw new BadMethodCallException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment