search

Home  >  Q&A  >  body text

laravel5.2.9 - Laravel5.2 changed users to user, but an error was reported. What else needs to be changed? I really can’t get used to plural numbers

I couldn’t get used to laravel’s plural table names, so I changed users to user.

is also defined in Model
protected $table = 'user';

But an error is still reported.
As long as it is from $request->user(), the users table will not exist. What is the situation? Solve

Figure 2 is the configuration in config/auth
Figure 3 is the user model

迷茫迷茫2774 days ago459

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-16 16:54:13

    Please see the error reporting part:

    If the error occurs in UserRegisterRequest 中進行 validate 的時候,因為你其中一個 rule
    'email' => 'unique:users,email' ,這會導致其去檢查 users 這個 table 裡面的 email 字段是否有重複(唯一性),所以你應該改成 'email' => 'unique:user,email' then it’s ok

    reply
    0
  • Cancelreply