Laravel - Auth :: attempt


Good morning community of Laravel, today I come with a challenge, I hope your favorable answers.

I would like to be able to authenticate myself with users of two different databases. Validate information is not a problem. In my application I have the connections prepared. (config / database.php I have configured a connection for 'db1' and 'db2') My doubt really arises when I customize the login, I use the Auth :: attempt code, which uses the default connection even if I try to set the Connection of the User model:

$user = \App\User; 
   return Redirect::to('/home');

This gives me an error because I try to validate data from db2 (name of the connection: mysql2). Auth :: attempt is configured to use the default connection in this case 'mysql' (database db1).

In this case I want to achieve a custom login at this level. I appreciate your answers.

asked by jota 23.11.2018 в 20:36

0 answers