0
votes

I'm trying to do the Authentication in my project laravel 5.2 the problem is I need to change the tables names because I have many projects in the same database.

I changed the name on users and password_resets tables in the following life:

  • \migrations....create_password_resets_table.php
  • \migrations....create_user_table.php
  • in \app\User.php i added protected $table = 'r_users';
  • in \Controllers\Auth\AuthController.php i changed 'email' => 'required|email|max:255|unique:r_users',
  • in \config\auth.php i put:

    'providers' => [ 'users' => [ 'driver' => 'database', 'table' => 'r_users', ], ],

    and

    'passwords' => [ 'users' => [ 'provider' => 'users', 'email' => 'auth.emails.password', 'table' => 'r_password_resets', 'expire' => 60, ],

With these changes I can add new user in the new tables and I can do the login and logout.

But when I try to password reset I get that error. Any idea to fix this problem?

I assume there are other variables that I need to change but I don't know which.

I did the test before change the tables names and it working.

1

1 Answers

0
votes

Take a look at the attribute prefix in the config/database.php. you just need to set a different prefix for every project.

.env

DB_TABLE_PREFIX=pfx

config/database.php

'prefix' => env('DB_TABLE_PREFIX', '')