apwnn
apwnn

Reputation: 87

How to use the default laravel authentication change using a different database name?

Laravel by default asks for a db called "laravel" and a users table called "users", but I named them in a different way and I want to make it works. Below the error it gives me:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.users' doesn't exist

EDIT: I kept the default config/database.php, changing nothing inside of it.

Upvotes: 1

Views: 179

Answers (1)

Ersoy
Ersoy

Reputation: 9594

You need to update your database name in config/database.php (check connections array) to not user laravel database. Please check .env file too, for laravel database name references.

To not use users table you need to update your User class's $table property. (User class comes with default laravel installation).

RegisterController/@validator method need to be updated to for a different table.

Upvotes: 1

Related Questions