HOGGAR Docs
Version 1.x
search
search
menu
HOGGAR Docs
search
search
Creating records
If you want to make a crud with wizard
php artisan hoggar:make-wizard
This an example of how to make wizard of 2 fields.$hoggarShowOther if you want to show or hide button 'createOther', $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 $hoggarShowOther = true;
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 hide the button "Create other" update the line.
public $hogarShowOther = false;
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);
  
    ... //  
}