Filament 自定义页面,提交的内容如何保存?

 <x-filament::form>
            <div style="display: flex;justify-items: center; flex-wrap: wrap;">
                @foreach(\App\Models\Up::select(['id', 'name', 'avatar'])->get() as $up)
                    <div style="margin: auto 24px">
                        <input type="radio" name="id" class="bg-green-500 hover:bg-green-600" value="{{$up->id}}"/>
                        <img src="{{asset('storage/'.$up->avatar)}}" width="64" height="64"
                             alt="{{$up->name}}"/>{{$up->name}}
                    </div>
                @endforeach
            </div>
        </x-filament::form>
Action::make('auto-lottery')
                    ->label('手动开奖')
                    ->visible($autoLottery)
                    ->modalContent(function ($record) {
                        return view('filament.resources.events.actions.manual', [
                            'record' => $record,
                        ]);
                    })->action(function ($record) {
                        $lottery = request()->input('id');
                        Notification::make()
                            ->title($lottery)
                            ->success()
                            ->send();
                    }),

现在怎么在 action 里面接收这个 form 的 id 值呢?

无论在现实或是网络中,我都是孤独的。
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1

试试在回调中,使用 $data 命名参数。参考此处

1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!