Multi-step form wizard:
Component
class RegistrationWizard extends Component
{
public int $step = 1;
public array $data = [];
public function nextStep()
{
$this->validateStep();
$this->step++;
}
public function previousStep()
{
$this->step--;
}
private function validateStep()
{
match($this->step) {
1 => $this->validate(['data.email' => 'required|email']),
2 => $this->validate(['data.name' => 'required']),
default => null
};
}
}View
@if($step === 1)
<input wire:model="data.email">
@elseif($step === 2)
<input wire:model="data.name">
@endif