--- tags: Laravel --- # 路由常見架構 ### 常見的路由寫法 ```php= Route::get('/', function () { return view('welcome'); }); ``` ```php= Route::post('/', 'PodeController@Create'); ``` ```php= // CRUD Route::resource('user', 'UserControllerlass'); ``` ### group 群組 ```php= //group 第一個參數是陣列 "key" Route::group([ "meddleware" => 'checkClick'], function () { Route::get('/', 'PodeController@Create'); Route::post('/', 'PodeController@Create'); }); ``` ### prefix 前墬詞 * 為你路由前制定你的前墜名詞 例如 : "web" ```php= Route::group( ["meddleware" => 'chankClick', "prefix" => 'web' "namespace" => 'web' ], function () { Route::get('/', 'PodeController@Create'); Route::post('/', 'PodeController@Create'); } ); ```  * 當後端路由 resource 產生這個bug時解的法  * 可在這資料匣中設定  * HOME 下方加上這段 ```php= protected $namespace = 'App\Http\Controllers'; ``` * 路由產生了 CRUD
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up