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
Auth::login($user);
return redirect()->route('/');
}
}
return redirect()->back()->withErrors(); // you would need to fill up the error
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community