You have article about that
http://blog.sarav.co/multiple-authentication-in-laravel-continued/
I am currently working on laravel 5.1 and i have implemented laravel's default auth for admin panel login. Now my application need front-end login for general user also. How can i do this ? For example. www.domain.com/admin (This is login page for admin) www.domain.com/login (This is login page for general Users) for both these pages i need separate login.
You have article about that
http://blog.sarav.co/multiple-authentication-in-laravel-continued/
Hello tomo_pongrac,
Is any simple way is available for this, that needs less configuration.
You can check this package
try http://imrealashu.in/code/laravel/multi-auth-with-laravel-5-2-2/. This package already implemented admin + user login and registration, using Admin and User model with their corresponding tables.
He has laravel 5.1 so i think that package wont work
I need in laravel 5.1
Are there any major differences in 5.1 and 5.2 ?
here is link
http://learninglaravel.net/what-are-laravel-52s-new-features
5.2 have Authentication Drivers / "Multi-Auth"
@tomo_pongrac that will work with some small modifications
@eijinaal If your application is quite small, then you may find it easier to add an extra column to the Laravel user model e.g. 'Role'. Then have everyone login using standard Laravel methods, and test the $user->role value to redirect users that are not value 'admin' away from your admin pages. Also write a simple isAdmin() function to help in this, or to include extra "admin" bits in your views...
Not as fancy as the previous suggestions, but for smaller apps it will be understandable and work without too much change to standard Laravel install. HTH
@eijinaal Here's a package that I'm working on: https://github.com/tylernathanreed/laravel-auth
It's literally just Multi-Auth from Laravel 5.2 refactored and dropped into 5.1.
I've actually gotten this to work in an existing 5.1 project, so I know that it does the basics. If you have any troubles setting it up, let me know. This package is still early in its development, so any feedback would be appreciated. I'm in the same boat as you, I needed Multi-Auth in 5.1, hence why I created the package in the first place.
I'm actively making any changes to this if any issues arise, so I'll definitely help with any problems you might have.
Hi @tylernathanreed , I was trying to implement your package in my project, but no luck. I followed the steps as described on github and ended up confusing me. I was stuck on Middleware, for example like in class RedirectIfAuthenticated, and I got error BindingResolutionException in Container.php line 749: Target [Reed\Auth\Contracts\Guard] is not instantiable. Do you have any complete sample for implementing the multi auth using your package for laravel 5.1?
Thanks
@eijinaal You should have one User model and users table, and then user “levels”. Have one login endpoint and you can then check whether the authenticated user’s an administrator or not, and use middleware to restrict their access.
@fikri1510 That's because you're still using the 5.1 RedirectIfAuthenticated Middleware. You need to be using the one from 5.2.
Please or to participate in this conversation.