vendredi 12 février 2016

Laravel 5.1: Eloquent Authentication Using Two Distinct User Models/Tables

My app needs to support two types of users:

  1. regular users , these are those who are subscribers (restaurants that use my app for managing their business). For these users, I have the out of box authentication (Laravel 5.1) set up. email and password are the fields I authenticate on. I maintain information about such users in my users table.
  2. guests, these are people who visit the restaurants above, register to earn loyalty points, check their score, leave feedback, etc. I maintain information about such users in my guests table. Authentication, in this case, is simple. I just use a mobile_number to authenticate them into the app.

I get that I can implement guest's authentication in a subdomain of my app, with different Controllers and Views.

What I don't get is, how can I use the eloquent database driver with the two distinct models? I see that we specify the model eloquent would be using through config.auth.model. So, I'm assuming that we can only have one single model implementing authentication.

Is, what I trying to achieve, possible without implementing a custom driver?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire