This was done using Laravel 5.8 but is easily portable to newer versions.
This is an exercise to scratch an itch and to respond to a Laracasts thread, feel free to use it as a jumping point for something magical!!!
Class | Purpose |
---|---|
App\CustomState |
A simple object that adds checks on the authenticated user. |
App\Http\Middleware\UserOnboarding |
Our custom middleware that uses the CustomState class to check that a user needs onboarding. |
App\Providers\AppServiceProvider |
Where we register our singleton instance of CustomState |
App\Http\Kernel |
Where we register our custom middleware. |