#4908 emlak24 needs

This commit is contained in:
diashalabi 2021-11-22 15:11:20 +03:00
parent a330fb8fae
commit 334728d424
2 changed files with 19 additions and 0 deletions

View File

@ -740,4 +740,21 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
->orderBy('distance')
->get();
}
public function getClassifiedsByCatsIDsAndLevels($categories, $limit = 10)
{
if (is_array($categories) && count($categories)) {
return $this->getModel()
->currentAds()
->where(function ($query) use ($categories) {
foreach ($categories as $level => $categoryID) {
$query->orWhereIn("cat$level", $categoryID);
}
})
->limit($limit)
->get();
}
return [];
}
}

View File

@ -76,4 +76,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
public function getNoImageClassifiedsReport();
public function getClassifiedsByCoordinates($lat, $lng, $distance = 50);
public function getClassifiedsByCatsIDsAndLevels($categories, $limit = 10);
}