I'm pretty new to Laravel and PHP but I have made an app that requires a user to log in, now this table is called users
and all my users sit in there, but I want to make another table called temUsers
and use that table instead... but I don't know where the code points to that user table so I can change it to temUsers
. Can anyone please assist in knowing which file would point to this?.
Asked
Active
Viewed 249 times
0

segawe
- 35
- 5
1 Answers
1
Add $table
property in User
model.
protected $table="temUsers";

John Lobo
- 14,355
- 2
- 10
- 20
-
would adding this line overwrite it from reading off the users table? – segawe Jun 29 '21 at 08:57
-
@segawe.yes it wil overwrite.after adding this line user model read data from temUsers – John Lobo Jun 29 '21 at 08:58
-
What about other pages calling the table? – segawe Jun 29 '21 at 09:25
-
@if you have used table name in query then you have no option i guess.but you can refactor yuor code by using this https://stackoverflow.com/questions/14082682/how-to-return-database-table-name-in-laravel/24477971 – John Lobo Jun 29 '21 at 09:28
-
`SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select count(*) as aggregate from `users` where `email` ` .....I get this error – segawe Jun 29 '21 at 11:27
-
do you have email column in temUsers table – John Lobo Jun 29 '21 at 11:34
-
yes I do, all the columns on the users match the new table – segawe Jun 29 '21 at 11:41
-
@segawe.then it should work.try clearing cache – John Lobo Jun 29 '21 at 11:43
-
this program is hosted on a server though...how would I clear cache from there – segawe Jun 29 '21 at 11:55