*/ public function rules(): array { /** @var Form */ $form = request()->route('form'); return [ 'sorting' => 'array', 'sorting.0' => 'required|string', 'sorting.1' => 'required|string|in:asc,desc', 'active_columns' => 'array', 'active_columns.*' => ['string', Rule::in([...$form->getFields()->pluck('key')->toArray(), 'created_at'])] ]; } /** * @param array $input */ public function handle(Form $form, array $input): void { $form->update(['meta' => $input]); } public function asController(Form $form, ActionRequest $request): JsonResponse { $this->handle($form, $request->validated()); return response()->json($form->fresh()->meta); } }