$this->id, 'account_no' => $this->reference_no, 'marking' => CompanyConnections::where('module_one', $this->modules->first()->id)->first()->marking, 'email' => $this->employees->first()->email, 'name' => $this->name, 'type' => $this->type, 'status' => (int) $this->status, 'delivery_address' => new AddressResource($this->deliveryAddress), 'contact' => new ContactResource($this->contacts->first()), 'total_orders' => count($this->orders), 'identification' => new DocumentResource($this->whenLoaded('documents', $this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first())), ]; } }