timolake/livewire-forms
livewire-forms
one form for creating & updating data, based on laravel livewire
Installation
You can install the package via composer:
composer require timolake/livewire-forms
How to use
- create class in \App\Http\Livewire\Forms and extend form timolake\LivewireForm or timolake\LivewireItemForm
- implement abstact classes
populate rules() with all attributes wich need to be edited
use model.attribute notation - create view
validation
for model validation always use model.attribute
public function rules(): array
{
return [
'model.name' => 'required|min:2|max:255',
];
}
for item validation, use model.items and selectedItem.attribute
public function rules(): array
{
return [
'items' => 'required|min:1',
];
}
public function itemRules(): array
{
return [
'selectedItem.foreign_key' => 'required|numeric',
'selectedItem.name' => 'required|min:2|max:255',
];
}
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
631,580,251
9,707
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
404,034,618
608
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
387,976,821
4,658