public static function sliderPhotoArray($text = true, $slide = true, $id = false) { $apartments = Apartment::sliderOrId($id)->active()->get(); $currency = Settings::item('currency'); $photos['path'] = []; $photos['slide'] = $slide; foreach ($apartments as $apartment) { if ($id) { $photos['path'] = array_pluck(self::photoArray($apartment->photos, $apartment->id), 'path'); // show apartment page } else { $photos['path'][] = self::firstPhoto($apartment->photos, $apartment->id, false); // home page } if ($text) { $photos['text'][] = '<a href="' . Url('/apartment/' . $apartment->id) . add_slug($apartment->slug) . '">' . $apartment->street . ', ' . $apartment->house . ' <br /> ' . $apartment->price . ' ' . trans('admin/settings.main.' . $currency) . '/' . trans('front/apartment.night') . '</a>'; } } $photos['count'] = count($photos['path']); return $photos; }