mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 07:16:06 -06:00
update
This commit is contained in:
parent
c55cf375d4
commit
8fc17027f8
@ -146,6 +146,10 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
$query = $query->whereDate('advs_advs.created_at', $param['created_at']);
|
$query = $query->whereDate('advs_advs.created_at', $param['created_at']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($param['start_publish_at']) && !empty($param['finish_publish_at'])) {
|
||||||
|
$query = $query->whereBetween('advs_advs.publish_at', [Carbon::make($param['start_publish_at'] . " 23:59"), Carbon::make($param['finish_publish_at'] . " 00:00")]);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($param as $para => $value) {
|
foreach ($param as $para => $value) {
|
||||||
if (substr($para, 0, 3) === "cf_") {
|
if (substr($para, 0, 3) === "cf_") {
|
||||||
$id = substr($para, 3);
|
$id = substr($para, 3);
|
||||||
@ -401,7 +405,8 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
return $this->model->orderBy('created_at', 'DESC')->whereIn('advs_advs.id', $ids)->get();
|
return $this->model->orderBy('created_at', 'DESC')->whereIn('advs_advs.id', $ids)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hideAdsWithoutOutOfStock($ads) {
|
public function hideAdsWithoutOutOfStock($ads)
|
||||||
|
{
|
||||||
return $ads->filter(
|
return $ads->filter(
|
||||||
function ($entry) {
|
function ($entry) {
|
||||||
return (($entry->is_get_adv == true && $entry->stock > 0) || ($entry->is_get_adv == false));
|
return (($entry->is_get_adv == true && $entry->stock > 0) || ($entry->is_get_adv == false));
|
||||||
@ -584,14 +589,16 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function currentAds() {
|
public function currentAds()
|
||||||
|
{
|
||||||
return $this->newQuery()->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
return $this->newQuery()->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||||
->where('status', '=', 'approved')
|
->where('status', '=', 'approved')
|
||||||
->where('slug', '!=', '')
|
->where('slug', '!=', '')
|
||||||
->orderBy('publish_at', 'desc');
|
->orderBy('publish_at', 'desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function expiredAds() {
|
public function expiredAds()
|
||||||
|
{
|
||||||
return $this->newQuery()
|
return $this->newQuery()
|
||||||
->whereDate('finish_at', '<', date("Y-m-d H:i:s"))
|
->whereDate('finish_at', '<', date("Y-m-d H:i:s"))
|
||||||
->where('slug', '!=', '')
|
->where('slug', '!=', '')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user