practices as $practice) { if ($practice->service_code === 'walkin') { $practices[] = $practice->id; } } foreach ($this->prices as $price) { if (in_array($price->priceable_id, $practices)) { $prices = $price->price_net; } } return [ 'doctors' => [ 'id' => $this->practitioner->person->id, 'name' => $this->practitioner->person->name, 'specialis' => 'Spesialis ' . $this->speciality->name, 'experience' => rand(5, 12), 'rating' => rand(20, 100), 'price' => Helper::currencyIdrFormat($prices), ] ]; } }