I have a Laravel 6 application.
In a typical application, the user would just specify their email
, where the email is unique.
However, in my application, I have 2 columns in the User model that is used to authenticate users.
app_id
email
unique(app_id, email)
So in order to login, we need to pass both an app_id
and an email
, along with the password
. The same email
could be used across different app_id
s.
How would I achieve this?
The default login actions provided by
Auth::routes()
are the following:This is the default
login
function, part of theAuthenticatesUsers
trait used by theLoginController
:There are a few ways to approach this.
Option 1: Override
login
function inLoginController
Option 2: Override both the
validateLogin
and thecredentials
functions inLoginController