> */ public function rules(): array { return [ '*.id' => 'required|integer|exists:groups,id', '*.inner_name' => 'required|string|max:255', '*.level' => ['required', 'string', Rule::in(Level::values())], '*.fileshare' => 'present|nullable', '*.fileshare.connection_id' => 'nullable|numeric|exists:fileshares,id', '*.fileshare.resource' => 'nullable|string', ]; } /** * @param array $groups */ public function handle(array $groups): void { foreach ($groups as $payload) { Group::find($payload['id'])->update(['level' => $payload['level'], 'inner_name' => $payload['inner_name'], 'fileshare' => $payload['fileshare']]); } } public function asController(ActionRequest $request): JsonResponse { $this->handle($request->validated()); return response()->json([]); } }