mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 14:56:13 -06:00
#244 Admin - Listing expired and not published ads (passive)
This commit is contained in:
parent
45749c39d9
commit
838134c62d
@ -83,7 +83,11 @@ return [
|
|||||||
'name' => 'Currency'
|
'name' => 'Currency'
|
||||||
],
|
],
|
||||||
'status' => [
|
'status' => [
|
||||||
'name' => 'Status'
|
'name' => 'Status',
|
||||||
|
'option' => [
|
||||||
|
'expired' => 'Expired',
|
||||||
|
'unpublished' => 'Unpublished'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'pending_adv' => [
|
'pending_adv' => [
|
||||||
'name' => 'Pending Ads'
|
'name' => 'Pending Ads'
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Adv\Table\Filter;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Table\Component\Filter\Contract\FilterInterface;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
|
class StatusFilterQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
public function handle(Builder $query, FilterInterface $filter)
|
||||||
|
{
|
||||||
|
if ($filter->getValue() == 'expired') {
|
||||||
|
$query->where('advs_advs.finish_at', '<=', Carbon::now());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter->getValue() == 'unpublished') {
|
||||||
|
$query->where('advs_advs.status', '!=', 'approved');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,6 +11,7 @@ use Illuminate\Filesystem\Filesystem;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
|
use Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
|
||||||
use Visiosoft\AdvsModule\Adv\Table\Filter\CityFilterQuery;
|
use Visiosoft\AdvsModule\Adv\Table\Filter\CityFilterQuery;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Table\Filter\StatusFilterQuery;
|
||||||
use Visiosoft\AdvsModule\Adv\Table\Filter\UserFilterQuery;
|
use Visiosoft\AdvsModule\Adv\Table\Filter\UserFilterQuery;
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd;
|
use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd;
|
||||||
@ -151,6 +152,14 @@ class AdvsController extends AdminController
|
|||||||
'filter' => 'select',
|
'filter' => 'select',
|
||||||
'query' => UserFilterQuery::class,
|
'query' => UserFilterQuery::class,
|
||||||
'options' => $users,
|
'options' => $users,
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'filter' => 'select',
|
||||||
|
'query' => StatusFilterQuery::class,
|
||||||
|
'options' => [
|
||||||
|
'expired' => 'visiosoft.module.advs::field.status.option.expired',
|
||||||
|
'unpublished' => 'visiosoft.module.advs::field.status.option.unpublished',
|
||||||
|
],
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user