mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #252 from openclassify/dia
#244 Admin - Listing expired and not published ads (passive)
This commit is contained in:
commit
287161392d
@ -83,7 +83,11 @@ return [
|
||||
'name' => 'Currency'
|
||||
],
|
||||
'status' => [
|
||||
'name' => 'Status'
|
||||
'name' => 'Status',
|
||||
'option' => [
|
||||
'expired' => 'Expired',
|
||||
'unpublished' => 'Unpublished'
|
||||
]
|
||||
],
|
||||
'pending_adv' => [
|
||||
'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 Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
|
||||
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\AdvModel;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd;
|
||||
@ -151,6 +152,14 @@ class AdvsController extends AdminController
|
||||
'filter' => 'select',
|
||||
'query' => UserFilterQuery::class,
|
||||
'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