#2560 e-madencilik kategori sıralama

This commit is contained in:
Diatrex 2020-11-05 13:15:07 +03:00
parent a3352013ed
commit 6195e3b29d
4 changed files with 18 additions and 9 deletions

View File

@ -0,0 +1,14 @@
<?php namespace Visiosoft\AdvsModule\Adv\Listeners;
use Anomaly\Streams\Platform\Ui\Table\Event\TableIsQuerying;
class AddTableCategoryColumn
{
public function handle(TableIsQuerying $event)
{
$query = $event->getQuery();
$query->join('cats_category_translations as cats_trans', 'advs_advs.cat1', '=', 'cats_trans.entry_id')
->select('advs_advs.*', 'cats_trans.name as cat');
}
}

View File

@ -10,6 +10,7 @@ use Visiosoft\AdvsModule\Adv\AdvRepository;
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
use Visiosoft\AdvsModule\Adv\Listeners\AddTableCategoryColumn;
use Visiosoft\AdvsModule\Http\Middleware\redirectDiffrentLang;
use Visiosoft\AdvsModule\Http\Middleware\SetLang;
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
@ -220,6 +221,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
protected $listeners = [
TableIsQuerying::class => [
AddAdvsSettingsScript::class,
AddTableCategoryColumn::class,
],
];

View File

@ -1,6 +1,5 @@
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
use Anomaly\Streams\Platform\Application\Application;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
@ -10,7 +9,6 @@ use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Anomaly\UsersModule\User\UserModel;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
use Visiosoft\AdvsModule\Adv\Table\Filter\CityFilterQuery;
@ -18,7 +16,6 @@ use Visiosoft\AdvsModule\Adv\Table\Filter\StatusFilterQuery;
use Visiosoft\AdvsModule\Adv\Table\Filter\UserFilterQuery;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
@ -156,11 +153,8 @@ class AdvsController extends AdminController
}
],
'category' => [
'value' => function (EntryInterface $entry, CategoryModel $categoryModel) {
$category = $categoryModel->getCat($entry->cat1);
if (!is_null($category))
return $category->name;
}
'sort_column' => 'cat',
'value' => 'entry.cat'
],
'finish_at',
]);

View File

@ -20,7 +20,6 @@ use Visiosoft\AdvsModule\Adv\Event\viewAd;
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
use Visiosoft\AlgoliaModule\Search\SearchModel;