定制 artisan-build/verbs-flux 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

artisan-build/verbs-flux

Composer 安装命令:

composer require artisan-build/verbs-flux

包简介

Turn your Verbs events into Flux forms.

README 文档

README

This package is being replaced by one in which Flux is optional.

Turn your Verbs events into Flux forms.

Usage

First, install the package: composer install artisan-build/verbs-flux

Next, add some attributes to your event to indicate what type of fields should be used:

namespace App\Events;

use App\States\UserBalance;
+ use ArtisanBuild\VerbsFlux\Attributes\EventForm;
+ use ArtisanBuild\VerbsFlux\Attributes\EventInput;
+ use ArtisanBuild\VerbsFlux\Enums\InputTypes;
use Thunk\Verbs\Attributes\Autodiscovery\StateId;
use Thunk\Verbs\Event;

+ #[EventForm()]
class FundsAdded extends Event
{
    #[StateId(UserBalance::class)]
    public int $userId;

+     #[EventInput(
+         type: InputTypes::Number,
+         label: 'Amount',
+         rules: ['required', 'numeric', 'min:0.01'],
+     )]
    public float $amount;

+     #[EventInput(
+         type: InputTypes::Text,
+         label: 'Notes',
+     )]
    public string $notes;

Finally, add a livewire component and indicate which event it should use:

<livewire:event-form :event="\App\Events\FundsAdded::class" />

Tip: you can include this inside a modal like this:

<flux:modal.trigger name="adjust-balance">
    <flux:button>Add Transaction</flux:button>
</flux:modal.trigger>

<flux:modal name="adjust-balance" class="md:w-96 space-y-6">
    <livewire:event-form :event="\App\Events\FundsAdded::class" />
</flux:modal>

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-06