MarvinLabs\SetupWizard\Middleware\SetupWizardInitializer::handle PHP Method

handle() public method

Handle an incoming request.
public handle ( Illuminate\Http\Request $request, Closure $next, string | null $guard = null ) : mixed
$request Illuminate\Http\Request
$next Closure
$guard string | null
return mixed
    public function handle($request, Closure $next, $guard = null)
    {
        // Send a forbidden status if wizard should not be triggered
        if (TriggerHelper::hasWizardCompleted()) {
            return $this->forbiddenResponse();
        }
        // Get the current step from the route slug
        $currentStepSlug = $request->route()->getParameter('slug', '');
        \SetupWizard::initialize($currentStepSlug);
        // Share common data with our views
        view()->share('currentStep', \SetupWizard::currentStep());
        view()->share('allSteps', \SetupWizard::steps());
        // Proceed as usual
        return $next($request);
    }
SetupWizardInitializer