added repo currenctAds

This commit is contained in:
vedatakd 2021-07-12 17:07:22 +03:00
parent 256f52c5ac
commit a659c6c015
2 changed files with 9 additions and 0 deletions

View File

@ -539,4 +539,11 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
return $query->where('finish_at', '>', date('Y-m-d H:i:s'))
->get();
}
public function currentAds() {
return $this->newQuery()->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
->where('status', '=', 'approved')
->where('slug', '!=', '')
->orderBy('publish_at', 'desc');
}
}

View File

@ -54,4 +54,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
public function approveAds($adsIDs);
public function getUserAds($userID = null, $status = "approved");
public function currentAds();
}