$CustomerChatAttr->getUserId(), 'message' => $CustomerChatAttr->getMessage(), 'image' => $CustomerChatAttr->getImage(), 'service_category_id' => $CustomerChatAttr->getServiceCategoryId(), 'is_log' => $CustomerChatAttr->getIsLog(), 'log_id' => $CustomerChatAttr->getLogId(), 'log_name' => $CustomerChatAttr->getlogName(), 'log_act' => $CustomerChatAttr->getLogAct(), 'log_related_users' => $CustomerChatAttr->getLogRelatedUsers() ? json_encode($CustomerChatAttr->getLogRelatedUsers()) : null, 'customer_id' => $CustomerChatAttr->getCustomerId(), 'site_project_id' => $CustomerChatAttr->getSiteProjectId() ?? null ]); return CustomerChat::find($res->id); } public function paginateByCustomerId(PaginateBuilderAttr $paginateBuilderAttr, $customerId): PaginateCollectionAttr { return (new PaginateCollectionAttrBuilder) ->build( CustomerChat::where('customer_id', $customerId)->with('user'), $paginateBuilderAttr, new PaginateSchemaCustomerChat ); } public function countDataByCustomerId($customerId) { return CustomerChat::where('customer_id', $customerId)->count(); } public function count() { return CustomerChat::count(); } }