Using username column instead of email to login to Laravel

Want to use username column to login to Laravel instead of email column, then Laravel has you covered.

Check out the Laravel Docs for more information on Authorisation.

Anyway lets get started...

First you need to add the column into the database by adding;

$table->string('username', 50)->unique();

into the 2014_10_12_000000_create_users_table.php file or by creating your own migration if you already have the project setup.

Add in Auth\LoginController.php

public function username()
    return 'username';

And thats it.