timolake / livewire-forms
一个用于创建和更新数据表单,基于Laravel Livewire
2.1.0
2024-08-28 15:48 UTC
Requires
- php: ^8.1
- illuminate/contracts: ~10|~11
- livewire/livewire: ^3.0
- spatie/laravel-package-tools: ^1.9.2
- dev-main
- 2.1.0
- 2.0.0
- 1.11.0
- 1.10.0
- 1.9.3.1
- 1.9.3
- 1.9.2
- 1.9.1.1
- 1.9.1
- 1.8.0
- 1.7.0
- 1.6
- 1.5
- 1.4
- 1.3.1
- 1.3
- 1.2.2
- 1.2.1
- 1.2
- 1.1
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- dev-develop
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5
- dev-dependabot/github_actions/actions/checkout-4
- dev-dependabot/github_actions/aglipanci/laravel-pint-action-2.3.0
- dev-dependabot/github_actions/ramsey/composer-install-2
This package is auto-updated.
Last update: 2024-09-28 16:00:03 UTC
README
一个用于创建和更新数据表单,基于Laravel Livewire
安装
您可以通过composer安装此包
composer require timolake/livewire-forms
如何使用
- 在 \App\Http\Livewire\Forms 中创建类,并扩展 form timolake\LivewireForm 或 timolake\LivewireItemForm
- 实现抽象类
在 rules() 中填充所有需要编辑的属性
使用 model.attribute 语法 - 创建视图
验证
对于模型验证,始终使用 model.attribute
public function rules(): array { return [ 'model.name' => 'required|min:2|max:255', ]; }
对于项目验证,使用 model.items 和 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', ]; }
变更日志
有关最近变更的更多信息,请参阅变更日志。
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。