data = $data; $this->witTotal = $witTotal; } public function toResponse( $request = null ) { if (!$this->data->isEmpty()) { foreach ($this->data as &$v) { $v->agent_name = $v->agent->username ?? ''; $v->commission_ratio = $v->agent->commission_ratio ?? ''; unset($v->agent); } } $result = $this->data->toArray(); $result['wit_total'] = $this->recTotal; return json_success($result); } }