I really try to debug my issues on my own before I bring them here, but I seriously cannot find a solution to my laravel auth problem, though it seems to be a common issue.
My authentication will not login. It always returns false and I don't understand why.
I am trying to login using auth:attempt but its not working . Going always in else condition.
When auth attempt getting success its automatically going in if condition otherwise other condition
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; use App\Http\Controllers\Redirect; use App\User; use Illuminate\Support\Facades\Auth; class AdminCreateLogin extends Controller { public function addAdmin(Request $request) { $name = $request->username; $password = $request->password; $password = Hash::make($password); $email = $request->email; $user= new User; $user->name = $name; $user->password = $password; $user->email = $email; $user->save(); } public function adminLogin(Request $request) { $email = $request->email; $password1 = $request->password; $password = bcrypt($password1); //$password = hash:make($password1); $userdata = array( 'email' => $email, 'password' => $password ); if(Auth::attempt($userdata)) { echo "login"; die; return redirect('/admin/post/list'); } else { echo "login not"; die; return back()->with('error',"Invalid Login"); } } } Please help me in this.
Auth::attempt()need raw password so no need tobcrypt ()itattempt