0

I am changing my users database table field email to email_id, how do I change that also in Fortify without any custom code and with no errors?

You ask why not custom code because I have to write all the forgot password, reset & many more custom code so I don't want that.

I find this comment in config/fortify.php anyone know how to define email in that or username

/*
|--------------------------------------------------------------------------
| Username / Email
|--------------------------------------------------------------------------
|
| This value defines which model attribute should be considered as your
| application's "username" field. Typically, this might be the email
| address of the users but you are free to change this value here.
|
| Out of the box, Fortify expects forgot password and reset password
| requests to have a field named 'email'. If the application uses
| another name for the field you may define it below as needed.
|
*/

All I can find is this custom solution for the login but I don't want custom code snippets.

Fortify::authenticateUsing(function (Request $request) {
            $user = User::where('email_id', $request->email_id)->first();
     
            if ($user &&
                Hash::check($request->password, $user->password)) {
                return $user;
            } else {
                return false;
            }
        });
4
  • define "custom code"? is a configuration value "custom code"? Commented Aug 22, 2024 at 10:15
  • no! why would you change email to email_id in the first place? doesn't make sense Commented Aug 22, 2024 at 11:21
  • Without custom code means I only want to change config or settings in order to do this and for the email to email_id replacement I have to change my whole project for that so that's not an option Commented Sep 23, 2024 at 7:28
  • See the comment that I put in the question @kris gjika PLEASE Commented Sep 23, 2024 at 7:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.