Creating Controller

Controllers are stored in folder

Code:
app/controllers
By default, there are 2 files in controllers folder.




Lets create a new Controller.

Code:
UserController.php
With following content.

Code:
<?php

class UserController extends BaseController {

    public function login()
    {
        return View::make('login');
    }

}
Routing to Controller

Lets say we need following Link routed to login function in UserController

Code:
http://localhost:8000/login



For this, edit
Code:
app/routes.php
Add following


Code:
Route::get('/login', 'UserController@login');

Now, if you go to url

http://localhost:8000/login





You get view not found error as in previous tutorial. So create view file in app/view folder.

Code:
<h1>Login</h1>

HTML Code for user login page goes here.
Now if you go to login URL, you get following page