Created
February 26, 2017 03:09
-
-
Save ahuggins/48b78855b29e8ca6fcc519498ea21761 to your computer and use it in GitHub Desktop.
Basic Routes
This file contains hidden or 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 | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | 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::group(['prefix' => 'admin'], function () { | |
| Voyager::routes(); | |
| }); | |
| Route::get('/', function () { | |
| return view('home'); | |
| }); | |
| Route::get('contact', function () { | |
| return view('contact'); | |
| }); | |
| Route::get('blog', function() { | |
| $posts = App\Post::orderBy('created_at', 'DESC')->paginate(5); | |
| return view('blog', ['posts' => $posts]); | |
| }); | |
| Route::get('blog/{slug}', function($slug) { | |
| $post = App\Post::findBySlug($slug); | |
| return view('post', ['post' => $post]); | |
| }); | |
| Route::get('{slug}', function() { | |
| return view('page'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment