Created
April 14, 2018 09:17
-
-
Save Mombuyish/2d23be7955ad8e5a8562c3588412639f to your computer and use it in GitHub Desktop.
route methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* 渲染頁面 | |
* resources/views/pages/about.blade.php | |
*/ | |
// 原始 | |
Route::get('/about', function() { | |
return view('pages.about'); | |
}); | |
// 5.5 or later. | |
Route::view('/about', 'pages.about'); | |
// 夾帶參數 | |
Route::view('/about', 'pages.about', ['year' => date('Y')]); | |
/* | |
* 重導 | |
*/ | |
// 原始 | |
Route::get('/old-about', function() { | |
return redirect('/about'); | |
}); | |
// 5.5 or later. | |
Route::redirect('/old-about', '/about'); | |
// 夾帶 http status code | |
Route::redirect('/old-about', '/about', 307); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment