'Change Laravel Fortify Auth Column Names
I tried following these steps to no avail https://stackoverflow.com/a/64299968/7309037
I have a User Table with the column name "EmailAddress" but Laravel is looking for "email" and I get the following error when trying to login:
SQLSTATE[42S22]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid column name 'email'. (SQL: select top 1 * from [User] where [email] = [email protected]) A column was not found
Solution 1:[1]
Have you tried this: https://laravel.com/docs/9.x/fortify#customizing-user-authentication
Add the following code to your FortifyServiceProvider file in the boot method:
Fortify::authenticateUsing(function (Request $request) {
$user = User::where('EmailAddress', $request->email)->first();
if ($user &&
Hash::check($request->password, $user->password)) {
return $user;
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |