*/ public function toArray(Request $request): array { if (!$this->resource) { return []; } return [ 'customer' => [ 'name' => $this->fullname, 'email' => $this->email, 'phone' => $this->phone, 'address' => $this->address, 'city' => $this->city, 'ward' => $this->ward, 'province' => $this->province, 'active_phone' => 1, 'active_zalo' => 1, 'gender' => $this->gender, 'date' => $this->created_at ? $this->created_at->format('Y-m-d H:i:s') : null, 'company' => $this->company ?? '', 'mst' => null, 'avatar' => $this->avatar, 'cmnd_after' => $this->cmnd_after, 'cmnd_before' => $this->cmnd_before, 'cmnd_active' => (bool) $this->identity_number, 'cmnd' => $this->cmnd, 'fb_link' => null, 'active_2fa' => 0, 'off_mail_marketing' => $this->off_mail_marketing, 'is_recharge_zalo' => 0, 'is_verify_telegram' => 0, ], 'credit' => [ 'credit' => $this->credit, 'total' => $this->total, 'point' => $this->point, 'point_used' => 0, 'point_total' => $this->point, ], 'service' => [ 'vps' => $this->vps()->count(), 'proxy' => 0, 'server' => 0, 'hosting' => $this->hosting()->count(), 'domain' => $this->domain()->count(), ] ]; } }