Merge pull request #217 from openclassify/dia

added a twig view function to get all advs [alibaba-theme]
This commit is contained in:
Fatih Alp 2020-01-10 15:22:56 +03:00 committed by GitHub
commit 32681ddc90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,22 @@ class AdvCriteria extends EntryCriteria
return $ads;
}
public function allAdvs()
{
$advModel = new AdvModel();
$latest_advs = AdvModel::query()
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
->where('status', '=', 'approved')
->where('slug', '!=', '')
->paginate($this->settings->value('visiosoft.theme.base::s-type-latest-limit'));
$ads = $advModel->getLocationNames($latest_advs);
foreach ($ads as $index => $ad) {
$ads[$index]->detail_url = $advModel->getAdvDetailLinkByModel($ad, 'list');
$ads[$index] = $advModel->AddAdsDefaultCoverImage($ad);
}
return $ads;
}
public function getCurrentLocale()
{