15.4 Routes
Ok, we have our tables, we have models, and since we are now following my workflow let’s
create placeholders for the routes we will need.
1 <?php
2
3 Route::get('/', function() {
4 // this is our list of posts
5 });
6
7 Route::get('view/(:num)', function($post) {
8 // this is our single view
9 });
10
11 Route::get('admin', function() {
12 // show the create new post form
13 });
1415 Route::post('admin', function() {
16 // handle the create new post form
17 });
18
19 Route::get('login', function() {
20 // show the login form
21 });
22
23 Route::post('login', function() {
24 // handle the login form
25 });
26
27 Route::get('logout', function() {
28 // logout from the system
29 });
Right, those are done. As you can see I am using GET and POST to show and handle forms with
the same URI.