Skip to content

Instantly share code, notes, and snippets.

@ahuggins
Created February 26, 2017 03:09
Show Gist options
  • Select an option

  • Save ahuggins/48b78855b29e8ca6fcc519498ea21761 to your computer and use it in GitHub Desktop.

Select an option

Save ahuggins/48b78855b29e8ca6fcc519498ea21761 to your computer and use it in GitHub Desktop.
Basic Routes
<?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