Editing records
This an example of how to make wizard of 2 fields.
$wizardCount
represente the numbers of steps. $wizardForm
represente the fields of each steps. $wizardLabel
represente the labels of each fields.$wizardStop
if you want to stop the form in some steps.
public $wizardCount = 2;
public $wizardForm = [1 => ['name'], 2 => ['age']];
public $wizardLabel = [1 => 'first', 2 => 'second'];
public $wizardStop = [1];
public function initField()
{
$this->form([
TextInput::make('name'),
Number::make('age'),
]);
}
If you want to validate yours fields go to store() method.
public function store(Request $request)
{
$request->validate([
'name' => ['required'],
]);
// ...
}
If you want to stop the wizard after the step 1, you can de this.
public $wizardStop = [1];
You can also modify a field just before putting to database.
public function store(Request $request)
{
// ...
$this->hogarRecord->name = 'robert';
$this->updateRecord($request);
... //
}