I would have everyone login with email address and have a field that denotes their role (staff.student, etc)
However, if you have to use username or email, I would check if the entered username contains a "@" if it does authenticate using email and password otherwise username and password
if(strpos($username, '@') === false )
{
if (Auth::attempt(['username' => $username, 'password' => $password]))
{
// A student authenticated
}
}else{
if (Auth::attempt(['email' => $username, 'password' => $password]))
{
// Someone else authenticated
}
}
untested,,,
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community