.url }})
model = $model;
- $this->settings = $settings;
$this->fileRepository = $fileRepository;
$this->folderRepository = $folderRepository;
}
- /**
- * Resolve the advs.
- *
- * @return AdvsInterface|null
- */
public function findById($id)
{
return $this->model->orderBy('created_at', 'DESC')->where('advs_advs.id', $id)->first();
}
- public function searchAdvs($type, $param = null, $customParameters = null, $limit = null, $category = null, $city = null)
+ public function searchAdvs(
+ $type, $param = null, $customParameters = null,
+ $limit = null, $category = null, $city = null, $paginate = true
+ )
{
$isActiveDopings = new AdvModel();
$isActiveDopings = $isActiveDopings->is_enabled('dopings');
@@ -239,7 +213,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
}
if ($type == "list") {
- return $query->paginate($this->settings->value('streams::per_page'));
+ return $paginate ? $query->paginate(setting_value('streams::per_page')) : $query;
} else {
return $query->get();
}
diff --git a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php
index 110673937..4118d90a4 100644
--- a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php
+++ b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvRepositoryInterface.php
@@ -6,7 +6,10 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
{
public function findById($id);
- public function searchAdvs($type, $param = null, $customParameters = null, $limit = null, $category = null, $city = null);
+ public function searchAdvs(
+ $type, $param = null, $customParameters = null,
+ $limit = null, $category = null, $city = null, $paginate = true
+ );
public function softDeleteAdv($id);
diff --git a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php
index 987cbb876..47efea43c 100644
--- a/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php
+++ b/addons/default/visiosoft/advs-module/src/Http/Controller/advsController.php
@@ -232,7 +232,17 @@ class AdvsController extends PublicController
}
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
- $advs = $this->adv_repository->searchAdvs('list', $param, $customParameters, null, $categoryId, $cityId);
+ $advs = $this->adv_repository->searchAdvs(
+ 'list', $param, $customParameters, null, $categoryId, $cityId, false
+ );
+
+ if ($isActiveDopings) {
+ $featuredAdvsQuery = clone $advs;
+ $advs = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')
+ ->listFeatures($featuredAdvsQuery)->union($advs);
+ }
+
+ $advs = $advs->paginate(setting_value('streams::per_page'));
$advs = $this->adv_repository->addAttributes($advs);
if ($advs->currentPage() > $advs->lastPage()) {
@@ -244,10 +254,6 @@ class AdvsController extends PublicController
), 301);
}
- if ($isActiveDopings and $param != null) {
- $featured_advs = app('Visiosoft\DopingsModule\Http\Controller\DopingsController')->listFeatures($advs);
- }
-
$seenList = null;
foreach ($advs as $index => $ad) {
$advs[$index]->detail_url = $this->adv_model->getAdvDetailLinkByModel($ad, 'list');