Support the ongoing development of →
Authentication Views Validation
Last updated 1 year ago.

You will need to create your own login method. You can either store this in the LoginController that comes with Laravel or make your own.

Instead of using the attempt method you could easily determine which you need to validate (username / email) and change your query based on that. Here is a quick example I could think of based on using the Request variable, etc.

$user = \App\User::where('username', $request->input('username'))->first(); // grab the user
if($user) {
 // found user
 if(\Hash::check($request->input('password'), $user->password) {
   // user correct

    return redirect()->route('/');

return redirect()->back()->withErrors(); // you would need to fill up the error

Sign in to participate in this thread!


Your banner here too?

jahid56 jahid56 Joined 29 Oct 2016


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.

© 2024 - All rights reserved.