Skip to content

Instantly share code, notes, and snippets.

@sh7ning
Last active February 6, 2017 01:32
Show Gist options
  • Save sh7ning/7310f7df596e3a3795f7f0cc9f6a6ffc to your computer and use it in GitHub Desktop.
Save sh7ning/7310f7df596e3a3795f7f0cc9f6a6ffc to your computer and use it in GitHub Desktop.
Laravel隐式路由

Laravel在做一些admin后台的时候,不想麻烦定义routes的时候,可以采用

Route::any('/{module}/{controller}/{action}', function($module, $controller, $action) {
    $controller = \App::make("\\App\\Http\\Controllers\\" . $module . "\\" . $controller . "Controller");
    return \App::call([$controller, $action]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment