Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Este es el filter
- Route::filter('formatoTipo', function($route){
- if (!$route->parameter('formato')){
- $route->setParameter('formato','PDF');
- }
- if (!$route->parameter('tipo')){
- $route->setParameter('tipo','IMPRESION');
- }
- });
- //Este el llamado a la ruta
- Route::get('param/{formato?}/{tipo?}', array('before'=>'formatoTipo','uses'=>'ApiCommonsController@param'));
- //Esta es la funcion dentro del controller
- public function param($formato = null, $tipo=null){
- return Response::json([$formato, $tipo], 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement