Boilerplate for website with frontend and backend (admin) pages.
This setup by default have users and admin_users table and their respective models and AuthControllers. Views for the admin is in the folder resources/views/admin. You can change the name to your liking.
Check the app/auth.php.
Check app/Http/Middleware/Authenticate.php. Define login redirect path for each guard if you are attempting to access a page that require auth credentials.
All Auth Controllers extends AuthBaseController then call the parent constructor and pass the guard in the parameter, the purpose of this is to make sure the url.intended is valid for current segment.
Example:
- Assuming that you are logged out.
- When you visit
/backend/admin-only, theurl.intendedis set to/backend/admin-only - Then you visit
/login(the guard of this will be 'web'), so the code in the constructor ofAuthBaseControllerwill remove theurl.intendedin the session because the current url intended is for the guard 'admin'.