protected function previousStep(Request $request) { try { // Undo the previous step. If success, we can redirect to its form $previousStep = \SetupWizard::previousStep(); if (!$previousStep->undo()) { return view()->make('setup_wizard::steps.default', ['errors' => $previousStep->getMessageBag()]); } return redirect()->route('setup_wizard.show', ['slug' => $previousStep->getSlug()]); } catch (StepNotFoundException $e) { return redirect()->route('setup_wizard.show'); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * * @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); }
function check_prereq() { return parent::check_prereq() && $this->check_mysql_version(); }