laravel 綜合帖

  1. 萬能路由
Route::group(['namespace' => 'Movie', 'prefix' => 'movie', 'as' => 'movie.'], function () {
    Route::any('{controller}/{action}', function ($controller, $action) {
        $namespace =  Request::route()->getAction('namespace');
        $uses = $namespace . '\\' . ucfirst($controller) . 'Controller@' . $action;
        $name = $controller . '.' . $action;
        return Request::route()->uses($uses)->name($name)->run();
    });
});
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章