I want to change the table name and some column names of laravel auth table.
What steps do I take or which code do I edit without breaking something?
I tried this before, and registration worked, but login didn't. Whenever I tried to log in, I got redirected back to the login page.
You can follow the below given steps:
Authenticatable
email input text field name to email_address.With the above all steps, we are ready with View part now let's start with customising the Auth
Now open config/auth.php
 'model' => App\User::class, to 'model' => App\Account:class inside providers array.Now we need to add new function inside app/Http/Auth/LoginController.php like below:
public function username(){ return 'email_address'; // this string is column of accounts table which we are going use for login }
Now we are done with all adjustment, you can test the functionality.
I have tested the functionality and its working like charm :)
you have to extend "Illuminate\Foundation\Auth\User" in your Account model.
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Account extends Authenticatable
{ 
  use Notifiable;
  //code here
  public function getEmailAttribute() {
      return $this->email_addr;
  }
  public function setEmailAttribute($value)
  {
    $this->attributes['email_addr'] = strtolower($value);
  }
}
and change in configuration file in "config/auth.php" in providers array
'users' => [
        'driver' => 'eloquent',
        'model' => App\Account::class,  //replace User to Account
    ],
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With