Laravel and non email authentication

Posted: 2014-05-20 13:11:36

Note to self. The Laravel docs are here that cover Authentication. But when it came time to use a filter and a non email based user name I had to modify the auth.basic filter, or any filter you want to use.

It ended up looking like this since I wanted user_account and not email to be the username for authentication.

//app/filters.php
Route::filter('auth.basic', function()
{
    return Auth::basic('user_account');
});

You can see this option here

//vendor/laravel/framework/src/Illuminate/Auth/Guard.php
public function basic($field = 'email', Request $request = null)