2 years ago

How to use different password column in default LoginController in laravel for login

Posted 2 years ago by zahidgani

Hi I have to use pwd field in Login controller where to used .I have try more code but not working.

Laravel 5.4


namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; use App\User;

class LoginController extends Controller { use AuthenticatesUsers; protected $redirectTo = '/home'; public function __construct() { $this->middleware('guest')->except('logout'); } public function authenticate(Request $request) {

    $email    = $request->input('email');
    $password = $request->input('password');

    if (Auth::attempt(['email'=>$email, 'pwd' =>$password])) 
        return redirect()->intended('home');
         return redirect()->intended('login')->with('status', 'Invalid Login Credentials !');



App\User.php protected $fillable = [ 'name', 'email', 'pwd', ];

----Table Structure is: users(id,name,email,pwd);

When I rename pwd to password in my database table then its working fine,but i ave to used pwd column ...

Please sign in or create an account to participate in this conversation.