php - Is there a better way to get arguments for controller in laravel? -
php - Is there a better way to get arguments for controller in laravel? -
in cakephp, there default way pass arguments controller. example, if controller method:
public function index($arg1 = "asia", $arg2 = "hk") { // controller code }
in cakephp, default url method parameter is:
http://link.to.my.host/public/testcontroller/method/arg1/arg2/
however, in laravel, pass arguments, need add together line route.php
route::any("test/{arg1}/{arg2}", "testcontroller@index");
the problem have more 10 controllers few methods in each of them, receiving same argument.(the parameter language settings) annoying write 30+ lines handle these cases , not mention adding arguments/methods/controllers project grows. there way utilize few lines tell laravel arg1 , arg2 set methods of controllers? (or @ to the lowest degree methods in particular controller?)
i know can handle things parameter, don't want makes url looks ugly. user able re-create language settings while copying url, post method not option.
php laravel laravel-routing
Comments
Post a Comment