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 值呢?
试试在回调中,使用 $data 命名参数。参考此处