I ussualy use the following project for roles Laratrust
However, if you want to check for certain values for people that are logging in, you can do the following:
On your login view, redirect the login button to another route, for example
auth/login
after that, make a new route in your web.php
Route::post('/auth/login', 'AccountController@authenticate');
(make specific controller for this or an already existing controller)
In that controller you can now do the authentication yourself
use Illuminate\Support\Facades\Auth;
class AccountController extends Controller
{
public function authenticate(Request $request)
{
// GET PUT IN INFO
$email = $request->email;
$password = $request->password;
// ATTEMPTING THE LOGIN
if (Auth::attempt(['email' => $email, 'password' => $password, 'role' => 0])){
// Authentication passed... Role is 0
return redirect()->intended('/dashboard');
}else{
return Redirect::back()->withError('Your details are incorrect or your role doesn't match the current structures');
}
}
}
If you want to connect more tables to your users, you can use relationships for that
Make a new column named emails
Emails
id - user_id - Email
In the user model you can now put
class User extends Authenticatable
{
public function emails()
{
return $this->hasMany('App\Email','user_id', 'id');
}
}
Take a look into relationships