Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 Auth - custom table with users

I'm learning Laravel auth now and I have small problem. I read some pages from Google about this mechanism and I'm using

Auth::attempt(['email'=>$request['email'],'password'=>$request['password']]);

Laravel gives me this error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'base.users' doesn't exist (SQL: select * from `users` where `email` = [email protected] limit 1)

In fact I don't have users table in my database, I'm using name accounts. How can I change default table in auth?

And additional question is: when I put data to Auth::attempt() data will changed to SQL query and all data will be get from base? How can I add more data than I get in base? For simple I have table ban which this field have number of days when ban goes end. And I want to add field isbanned which get TRUE/FALSE data. If ban>0 will be TRUE, otherwise FALSE.

like image 558
ventaquil Avatar asked Dec 14 '22 14:12

ventaquil


1 Answers

In config/auth.php change 'table' => 'users' to 'table' => 'accounts'

like image 99
tnash Avatar answered Dec 25 '22 11:12

tnash