SuperAPI AI Directory

livewire-form-object

Coding & development

View repository

Updated 10-16 09:33

About this skill

When to use me

  • When form logic needs to be reused across multiple components
  • When forms are large and need better organization
  • When the same form is used in different contexts (create vs edit)

Initial Setup

php artisan livewire:form ModelFormObject
namespace App\Livewire\Forms;

use App\Models\Model; use Livewire\Attributes\Validate; use Livewire\Form; use Naykel\Gotime\Traits\Crudable; use Naykel\Gotime\Traits\Formable;

class ModelFormObject extends Form { use Crudable, Formable;

public function init(Model $model): void
{
    $this->editing = $model;
    $this->setFormProperties($this->editing);
}

}