<?php /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/', function () { return view('welcome'); }); Route::get('abc', function() { return view('artcle'); }); /*Route::get('artcle/index', "ArtcleController@index"); Route::get('artcle/create', "ArtcleController@create"); Route::post('artcle/store', "ArtcleController@store"); */ // 路由组 Route::prefix('artcle')->group(function() { Route::get('index', 'ArtcleController@index'); Route::get('create', 'ArtcleController@create'); Route::post('store', 'ArtcleController@store'); }); //新目录控制器路由 // Route::get('admin/admin/index', "AdminAdminController@index"); // Route::get('admin/admin/create', "AdminAdminController@create"); // Route::post('admin/admin/store', "AdminAdminController@store"); // 多级目录路由组 /*Route::prefix('admin/admin')->namespace('Admin')->group(function() { Route::get('index', "AdminController@index"); Route::get('create', "AdminController@create"); Route::post('store', "AdminController@store"); });*/ // 或者多级路由组嵌套使用 适用于目录下有多个控制器 Route::prefix('admin')->namespace('Admin')->group(function() { Route::prefix('admin')->group(function() { Route::get('index', "AdminController@index"); Route::get('create', "AdminController@create"); Route::post('store', "AdminController@store"); }); Route::prefix('tag')->group(function() { Route::get('index', "TagController@index"); Route::get('create', "TagController@create"); Route::post('store', "TagController@store"); }); }); // 远古写法 /*Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function() { Route::group(['prefix' => 'admin'], function() { Route::get('index', "AdminController@index"); Route::get('create', "AdminController@create"); Route::post('store', "AdminController@store"); }); Route::group(['prefix' => 'tag'], function() { Route::get('index', "TagController@index"); Route::get('create', "TagController@create"); Route::post('store', "TagController@store"); }); }); */