Support the ongoing development of Laravel.io →
Authentication
Last updated 3 months ago.
0

Assuming you are on Laravel 5.X, you can specify the column you want to use as the username in your AuthController:

/**
 * The username of the user
 * @var [type]
 */
protected $username = 'username';
0

Thanks for your help, but I am using a middleware but not AuthController... I cannot use the protected $username field. What should I do?

This is my middleware:

`namespace App\Http\Middleware; use Auth; use Closure; class AuthenticateOnceWithBasicAuth {

public function handle($request, Closure $next)
{
    return Auth::onceBasic() ?: $next($request);
}

}`

Last updated 6 years ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.