*/ public function rules(): array { return [ 'connectedAppId' => 'nullable|exists:connected_apps,id', 'issueCategory' => 'required|string', 'routingType' => 'nullable|in:role,user,none', 'notifiedRoleIds' => 'role' === $this->routingType ? 'required|array|min:1' : 'nullable|array', 'notifiedRoleIds.*' => 'role' === $this->routingType ? 'exists:roles,id' : 'nullable', 'notifiedUserIds' => 'user' === $this->routingType ? 'required|array|min:1' : 'nullable|array', 'notifiedUserIds.*' => 'user' === $this->routingType ? 'exists:users,id' : 'nullable', 'description' => 'Others' === $this->issueCategory ? 'required|string|min:20' : 'nullable|string', 'attachment' => 'Others' === $this->issueCategory ? 'nullable|file|mimes:jpg,jpeg,png,pdf|max:5120' : 'nullable', ]; } /** * Define validation attributes. * * @return array */ public function validationAttributes(): array { return [ 'connectedAppId' => 'service', 'issueCategory' => 'issue category', 'routingType' => 'routing type', 'notifiedRoleIds' => 'notified roles', 'notifiedUserIds' => 'notified users', 'description' => 'description', 'attachment' => 'file attachment', ]; } }