zahidgani
1445
4
Laravel

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

Posted 1 year 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

Auth\LoginController.php

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');
    }
    else
    {
         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.

Reply to

Use Markdown with GitHub-flavored code blocks.