Back in November of 2013, this package was the hero we all needed, swooping in and preventing us from having to have our customer and admins in the same database table.
With the introduction of multiple guard support in the core of Laravel, multiauth hung up its cape and spandex in June of 2015, for what was believed to be the last time.
Fast forward to 2019. The multiauth support in the core of Laravel hasn't changed much, and its scaffolding and implementation seem like more of an afterthought than an actual feature.
So it is with this, that multiauth will return, once again donning its cape and spandex.
Changes
Multiauth will be somewhat different this time, focusing less on introducing new functionality, and more on improving the core functionality already present in Laravel.
The primary focus will be on the following:
[ ] Improving the make:auth command to facilitate proper multiauth
[ ] An overhaul of the Auth scaffolding (app/Http/Controllers/Auth) that comes with every installation
[ ] An overhaul of the Auth::routes() command, again to facilitate multiauth
Current Problems
The reason I archived and abandoned this package originally was that I didn't think it was needed, and it wasn't, until now.
The following are problems with how Laravel handles multiauth, and the primary things I'll be looking to fix:
[ ] The controller scaffolding doesn't support multiauth at all
[ ] You need to duplicate the scaffolding for each new type of auth that you want
[ ] The Auth::routes() command again assumes a single auth type by default
[ ] The middleware allows you to specify multiple guards, which frankly is a super fringe case use
[ ] You need to add a bunch of ifs or a switch statement to the middleware, switching on the guard provided (often having to check $guards[0] assuming that there's only one provided) so that it redirects to the correct place
[ ] You have to override the default exception handler method unauthenticated(), again adding a bunch of ifs or a switch statement
[ ] The auth scaffolding is horrifically complicated, and it can be next to impossible to track down every file (read: trait) that is used
Possible Extras
The following are possible extras to be considered:
[ ] Make Authorisation gates have better support for multiauth
[ ] Make Policies have better support for multiauth
[ ] Methods in the router for protecting specific routes automatically
[ ] Magic link login
Input
If you:
Have an issue that isn't raised above
Have an interesting solution to one of the problems mentioned here
Intro
Back in November of 2013, this package was the hero we all needed, swooping in and preventing us from having to have our customer and admins in the same database table.
With the introduction of multiple guard support in the core of Laravel, multiauth hung up its cape and spandex in June of 2015, for what was believed to be the last time.
Fast forward to 2019. The multiauth support in the core of Laravel hasn't changed much, and its scaffolding and implementation seem like more of an afterthought than an actual feature.
So it is with this, that multiauth will return, once again donning its cape and spandex.
Changes
Multiauth will be somewhat different this time, focusing less on introducing new functionality, and more on improving the core functionality already present in Laravel.
The primary focus will be on the following:
make:auth
command to facilitate proper multiauthapp/Http/Controllers/Auth
) that comes with every installationAuth::routes()
command, again to facilitate multiauthCurrent Problems
The reason I archived and abandoned this package originally was that I didn't think it was needed, and it wasn't, until now.
The following are problems with how Laravel handles multiauth, and the primary things I'll be looking to fix:
Auth::routes()
command again assumes a single auth type by defaultif
s or aswitch
statement to the middleware, switching on the guard provided (often having to check$guards[0]
assuming that there's only one provided) so that it redirects to the correct placeunauthenticated()
, again adding a bunch ofifs
or aswitch
statementPossible Extras
The following are possible extras to be considered:
Input
If you:
Then respond here.