Skip to content

Commit

Permalink
Should back to previous step without validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ycs77 committed Sep 8, 2024
1 parent 0e7ccc2 commit 71568ee
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Wizardable.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ public function store(Request $request, string $step)

$step = $this->getWizardStep($request, $step);

if ($step->skip() && $request->query('_trigger') === 'skip') {
// If trigger from 'back', set this step index and redirect to prev step.
if ($request->query('_trigger') === 'back' && $this->beforeBackWizardStep($request)) {
if ($this->wizard()->option('cache')) {
$step->cacheProgress($request);
}

$prevStep = $this->wizard()->stepRepo()->prev();

return $this->setThisStepAndRedirectTo($request, $prevStep);
} elseif ($step->skip() && $request->query('_trigger') === 'skip') {
if ($this->wizard()->option('cache')) {
$step->cacheProgress($request);
}
Expand All @@ -128,13 +137,6 @@ public function store(Request $request, string $step)
if ($redirectTo = $this->wizardStepSaved($request, $step)) {
return $redirectTo;
}

// If trigger from 'back', set this step index and redirect to prev step.
if ($request->query('_trigger') === 'back' && $this->beforeBackWizardStep($request)) {
$prevStep = $this->wizard()->stepRepo()->prev();

return $this->setThisStepAndRedirectTo($request, $prevStep);
}
}

if ($this->isLastStep()) {
Expand Down

0 comments on commit 71568ee

Please sign in to comment.