mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
commit
ec8e384410
@ -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 [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,4 +76,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
||||
public function getNoImageClassifiedsReport();
|
||||
|
||||
public function getClassifiedsByCoordinates($lat, $lng, $distance = 50);
|
||||
|
||||
public function getClassifiedsByCatsIDsAndLevels($categories, $limit = 10);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user