The project I'm currently working on is split up in an admin console and the normal frontend. Both front and backend are in the same Laravel instance.
In the frontend I'm trying to create a user login system that works exclusively for the frontend. It uses a different table and model and it has different relations as oposed to the User model for the admin.
What I can't figure out is a way to use the Laravel Auth class for both systems. Logically Auth uses one single config file, and more to the point, one session name.
One solution that has been brought forward is not to use a different table and model and use some form of acl for the distinction. But I don't like the idea of mixing frontend and backend in this way. Especially because it would mean I'd suddenly have to give the admin User model all the fields and relations previously unique to the frontend user.
It just doesn't seem the right way to do things. I could switch to a different authentication system or seperate the admin into a package with its own configs but the scope of the project doesn't allow for such timeconsuming changes.
I'd welcome any idea's you could provide.
I'm not sure, but maybe it's useful. Why not try to create to separate environment for admin. And then you will have something like app/config/admin/session.php and app/config/session.php for production(which is the default environment).
You can see here how to setup environments http://andrewelkins.com/programming/php/how-to-set-laravel-4-environments/
But as I said it's just an idea, I'm not quite sure of it :)
Sounds like you should consider splitting the app into two codebases if the different user entities rarely or never need to see the same interface. They would still query the same database obviously.
Not only will this solve your auth issues, but also make maintaining the code a heck of a lot easier. For example, while pushing updates to the admin console you would only need to put that app in maintenance mode while keeping the (presumably) more critical frontend up and running.
This is a problem that I encountered recently too. The whole separate environment wasn't very easy, especially if you already have development and production environments.
I did however spend some time creating a package to solve this problem, which you can find at https://github.com/ollieread/multiauth. The package itself is essentially a factory class for Auth, that allows you to use multiple instances of it, so you access it like so:
I hope the package helps you or anyone else looking for this approach.