steelants / livewire-form
Simple Form class based on Laravel & Livewire
dev-main
2025-01-06 23:11 UTC
Requires
- laravel/framework: ^11.0
- livewire/livewire: ^2.0|^3.0
- steelants/form: ^1.3
This package is auto-updated.
Last update: 2025-01-06 23:11:54 UTC
README
Basic Form Component For Creation/Update of model
<?php namespace App\Livewire; use App\Models\PersonChild; use SteelAnts\LivewireForm\Livewire\FormComponent; use SteelAnts\LivewireForm\Traits\HasModel; class FormTest extends FormComponent { use HasModel; public $model = PersonChild::class; public $model_id; //Oweride default labels generated from $fillables of model or define own if you are not using them HasModel Attribute function labels(){ return [ 'name' => __('Jméno') ]; } function onSuccess(){ //DO SOMETHING ON SUCESS; } function onError(){ //DO SOMETHING ON ERROR; } }
@livewire('form-test', ['model_id' => 2])
Dev Enviroment
- Clone Repo to
[LARVEL-ROOT]packages/
- Modify ;composer.json`
"autoload": { "psr-4": { ... "SteelAnts\\LivewireForm\\": "packages/livewire-form/src/" ... } },
- Add (code below) to:
[LARVEL-ROOT]packages/bootstrap/providers.php
SteelAnts\LivewireForm\LivewireFormServiceProvider::class,