corporate_id_partner; $corporateIds = explode(',', $corporateId); $corporatePartner = '-'; if (count($corporateIds) > 0){ $corporatePartnerNames = Corporate::whereIn('id', $corporateIds)->get(); if (count($corporatePartnerNames)>0){ $corporateName = []; foreach($corporatePartnerNames as $corporatePartnerName){ array_push($corporateName, $corporatePartnerName->name); } $corporatePartner = implode(', ', $corporateName); } } $organization = [ 'id' => $this->id, 'name' => $this->name, 'type' => $this->type, 'code' => $this->code, 'description' => $this->description, 'kodeRs' => $this->meta->KodeRS ?? null, 'phone' => $this->meta->phone ?? null, 'lat' => $this->currentAddress->lat ?? null, 'lng' => $this->currentAddress->lng ?? null, 'address' => $this->currentAddress->text ?? null, 'province_id' => $this->currentAddress->province_id ?? null, 'city_id' => $this->currentAddress->city_id ?? null, 'district_id' => $this->currentAddress->district_id ?? null, 'village_id' => $this->currentAddress->village_id ?? null, 'postal_code' => $this->currentAddress->postal_code ?? null, 'corporate_id_partner' => $this->corporate_id_partner ?? null, 'corporate_name' => $corporatePartner, 'active' => $this->status == 'active' ? 1 : 0, ]; return $organization; } }