user(); return [ 'action' => 'required|string|in:archive,restore,delete,template', 'ids' => ['required','bail','array',Rule::exists('clients', 'id')->where('company_id', $user->company()->id)], 'template' => 'sometimes|string', 'template_id' => 'sometimes|string', 'send_email' => 'sometimes|bool' ]; } public function prepareForValidation() { $input = $this->all(); if (isset($input['ids'])) { $input['ids'] = $this->transformKeys($input['ids']); } $this->replace($input); } }