I am trying to register an user using Laravel's native auth. Login works fine, but when I try to register a new user I get an error after submitting a form:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'my_db.user' doesn't exist
Of course, I made a table named users
which I think has more sense and never had trouble up until now.
I am using Entrust
for roles and permissions, so I had to change auth.php
to:
'providers' => [
'user' => [
'driver' => 'eloquent',
'model' => User::class,
],
but even if I make this:
'providers' => [
'user' => [
'driver' => 'eloquent',
'model' => User::class,
'table' => users
],
it submits a form on user
table
First make sure you have properly created your model at User.php
and correctly linked your user
table. For example protected $table = 'user';
Then make sure to change validator
function in the RegisterController.php
.
Note: I think you getting error while validating inputs, not submitting to database. Because it checks already registered users(uniqueness) on the database, before adding to it. So, carefully check your email
validation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.