mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Optimize homepage cats queries
This commit is contained in:
parent
bfa1c12aa4
commit
a03f373374
@ -43,18 +43,15 @@ class AdvsModulePlugin extends Plugin
|
|||||||
), new \Twig_SimpleFunction(
|
), new \Twig_SimpleFunction(
|
||||||
'latestAds',
|
'latestAds',
|
||||||
function () {
|
function () {
|
||||||
|
|
||||||
if (!$latestAds = $this->dispatch(new LatestAds())) {
|
if (!$latestAds = $this->dispatch(new LatestAds())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $latestAds;
|
return $latestAds;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new \Twig_SimpleFunction(
|
new \Twig_SimpleFunction(
|
||||||
'appendRequestURL',
|
'appendRequestURL',
|
||||||
function ($request, $url, $new_parameters, $removeParams = []) {
|
function ($request, $url, $new_parameters, $removeParams = []) {
|
||||||
|
|
||||||
return $this->dispatch(new appendRequestURL($request, $url, $new_parameters, $removeParams));
|
return $this->dispatch(new appendRequestURL($request, $url, $new_parameters, $removeParams));
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1065,13 +1065,6 @@ class AdvsController extends PublicController
|
|||||||
return $this->view->make('theme::passwords/reset', compact('code'));
|
return $this->view->make('theme::passwords/reset', compact('code'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function homePage(CategoryRepositoryInterface $repository)
|
|
||||||
{
|
|
||||||
$cats = $repository->mainCats();
|
|
||||||
|
|
||||||
return $this->view->make('theme::addons/anomaly/pages-module/page', compact('cats'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mapJson(Request $request, AdvRepositoryInterface $repository)
|
public function mapJson(Request $request, AdvRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$param = $request->toArray();
|
$param = $request->toArray();
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
{% set sub_categories_limit = setting_value('visiosoft.theme.base::home_page_sub_categories_limit') %}
|
|
||||||
|
|
||||||
<ul class="categories-list px-0 mr-2 d-block d-sm-none">
|
<ul class="categories-list px-0 mr-2 d-block d-sm-none">
|
||||||
<li class="categories-list-li category-icon text-truncate category-{{ main_category.slug }}">
|
<li class="categories-list-li category-icon text-truncate category-{{ main_category.slug }}">
|
||||||
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
|
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
|
||||||
{% set catIcon = main_category.icon.path != "" ? url('files/' ~ main_category.icon.path) : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
|
<img src="{{ catIcon(main_category.icon.path) }}" alt="{{ main_category.name }}" class="img-responsive">
|
||||||
<img src="{{ catIcon }}" alt="{{ main_category.name }}" class="img-responsive">
|
|
||||||
<span>{{ main_category.name }}</span>
|
<span>{{ main_category.name }}</span>
|
||||||
<p class="p-0 sub-categories">
|
<p class="p-0 sub-categories">
|
||||||
{% set sub_categories = entries('cats','category').where('parent_category_id', main_category.id).where('deleted_at', null).orderBy('sort_order').get() %}
|
{% for subcats in cats.subcats %}
|
||||||
{% for sub_category in sub_categories|slice(0,sub_categories_limit) %}
|
{% if main_category.id == subcats.id %}
|
||||||
{{ sub_category.name }},
|
{{ subcats.c2_name }},
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -1,46 +1,38 @@
|
|||||||
{% set sub_categories_limit = setting_value('visiosoft.theme.base::home_page_sub_categories_limit') %}
|
|
||||||
{% set showAdsCount = setting_value('visiosoft.module.advs::show_ads_count') %}
|
|
||||||
<ul class="categories-list p-0 d-none d-sm-block">
|
<ul class="categories-list p-0 d-none d-sm-block">
|
||||||
<li class="categories-list-li category-icon category-{{ main_category.slug }}">
|
<li class="categories-list-li category-icon category-{{ main_category.slug }}">
|
||||||
{% set catIcon = main_category.icon.path != "" ? url('files/' ~ main_category.icon.path) : img('visiosoft.theme.base::images/default-categories-icon.png').url %}
|
<img src="{{ catIcon(main_category.icon.path) }}" alt="{{ main_category.name }}" class="img-responsive">
|
||||||
<img src="{{ catIcon }}" alt="{{ main_category.name }}" class="img-responsive">
|
|
||||||
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
|
<a href="{{ url_route('adv_list_seo', [main_category.slug]) }}" class="main-category">
|
||||||
<b>{{ main_category.name }}</b>
|
<b>{{ main_category.name }}</b>
|
||||||
{% if showAdsCount %}
|
{% if showAdsCount %}
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
({{ catAdsCount }})
|
({{ main_category.adcount }})
|
||||||
</small>
|
</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
<ul class="p-0">
|
<ul class="p-0">
|
||||||
{% set sub_categories = entries('cats','category').where('parent_category_id', main_category.id).where('deleted_at', null).orderBy('sort_order').get() %}
|
{% set subCatCount = 0 %}
|
||||||
{% set subCatLoop = [
|
{% for subcats in cats.subcats %}
|
||||||
{
|
{% if main_category.id == subcats.id %}
|
||||||
'start': 0,
|
{% set subCatCount = subCatCount + 1 %}
|
||||||
'end': sub_categories_limit,
|
|
||||||
'class': '',
|
{% set hideclass = "" %}
|
||||||
},
|
{% if subCatCount > sub_categories_limit %}
|
||||||
{
|
{% set hideclass = "hidden hidden-category" %}
|
||||||
'start': sub_categories_limit,
|
{% endif %}
|
||||||
'end': count(sub_categories),
|
|
||||||
'class': 'hidden hidden-category',
|
<li class="{{ hideclass }}">
|
||||||
}
|
<a href="{{ url_route('adv_list_seo', [subcats.c2_slug]) }}"
|
||||||
] %}
|
class="">{{ subcats.c2_name }}</a>
|
||||||
{% for subLoop in subCatLoop %}
|
|
||||||
{% for sub_category in sub_categories|slice(subLoop.start, subLoop.end) %}
|
|
||||||
<li class="{{ subLoop.class }}">
|
|
||||||
<a href="{{ url_route('adv_list_seo', [sub_category.slug]) }}">{{ sub_category.name }}</a>
|
|
||||||
{% if showAdsCount %}
|
{% if showAdsCount %}
|
||||||
{% set catLevel = getParentsCount(sub_category.id) + 1 %}
|
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
({{ catAdsCount }})
|
({{ subcats.adcount }})
|
||||||
</small>
|
</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if count(sub_categories) > sub_categories_limit %}
|
{% if subCatCount > sub_categories_limit %}
|
||||||
<li class="show-all" data-limit="{{ sub_categories_limit }}">
|
<li class="show-all" data-limit="{{ sub_categories_limit }}">
|
||||||
<a>
|
<a>
|
||||||
<span class="">
|
<span class="">
|
||||||
@ -51,7 +43,6 @@
|
|||||||
{{ trans('visiosoft.theme.base::button.hide_all') }}
|
{{ trans('visiosoft.theme.base::button.hide_all') }}
|
||||||
<i class="fas fa-arrow-circle-up"></i>
|
<i class="fas fa-arrow-circle-up"></i>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<div class="col left-categories-section mx-0">
|
{% set sub_categories_limit = setting_value('visiosoft.theme.base::home_page_sub_categories_limit') %}
|
||||||
|
{% set showAdsCount = setting_value('visiosoft.module.advs::show_ads_count') %}
|
||||||
|
|
||||||
|
<div class="col left-categories-section mx-0">
|
||||||
<ul class="categories-list p-0 d-none d-sm-block mb-0">
|
<ul class="categories-list p-0 d-none d-sm-block mb-0">
|
||||||
<li class="categories-list-li category-icon border-bottom-0 mt-0">
|
<li class="categories-list-li category-icon border-bottom-0 mt-0">
|
||||||
<img src="{{ img('visiosoft.theme.base::images/store-search.png').url }}" class="img-responsive">
|
<img src="{{ img('visiosoft.theme.base::images/store-search.png').url }}" class="img-responsive">
|
||||||
@ -35,12 +37,10 @@
|
|||||||
</li>
|
</li>
|
||||||
{{ addBlock('base/leftSidebar')|raw }}
|
{{ addBlock('base/leftSidebar')|raw }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{ addBlock('base/categoriesRow')|raw }}
|
{{ addBlock('base/categoriesRow')|raw }}
|
||||||
|
|
||||||
<div class="col-12 p-0 m-0">
|
<div class="col-12 p-0 m-0">
|
||||||
{% set main_categories = entries('cats','category').where('parent_category_id', null).where('deleted_at', null).orderBy('sort_order').get() %}
|
{% set cats = getLevel2Cats() %}
|
||||||
{% for main_category in main_categories %}
|
{% for main_category in cats.maincats %}
|
||||||
{% include "visiosoft.theme.base::partials/categories-web" %}
|
{% include "visiosoft.theme.base::partials/categories-web" %}
|
||||||
{% include "visiosoft.theme.base::partials/categories-mobile" %}
|
{% include "visiosoft.theme.base::partials/categories-mobile" %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
|
||||||
|
|
||||||
class VisiosoftModuleCatsCreatePlaceholderforsearchStream extends Migration
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The stream definition.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $stream = [
|
|
||||||
'slug' => 'placeholderforsearch',
|
|
||||||
'title_column' => 'name',
|
|
||||||
'translatable' => true,
|
|
||||||
'versionable' => false,
|
|
||||||
'trashable' => false,
|
|
||||||
'searchable' => false,
|
|
||||||
'sortable' => false,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The stream assignments.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $assignments = [
|
|
||||||
'name' => [
|
|
||||||
'translatable' => true,
|
|
||||||
'required' => true,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -11,9 +11,5 @@ class VisiosoftModuleCatsAlterIndexToAllTable extends Migration
|
|||||||
Schema::table('cats_category_translations', function (Blueprint $table) {
|
Schema::table('cats_category_translations', function (Blueprint $table) {
|
||||||
$table->index('entry_id');
|
$table->index('entry_id');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('cats_placeholderforsearch_translations', function (Blueprint $table) {
|
|
||||||
$table->index('entry_id');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class VisiosoftModuleCatsAdcount extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'category',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fields = [
|
||||||
|
'adcount' => 'anomaly.field_type.integer',
|
||||||
|
'adcount_updateat' => 'anomaly.field_type.datetime'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $assignments = [
|
||||||
|
'adcount' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,11 +4,6 @@ return [
|
|||||||
'category' => [
|
'category' => [
|
||||||
'read',
|
'read',
|
||||||
'write',
|
'write',
|
||||||
'delete',
|
'delete'
|
||||||
],
|
]
|
||||||
'placeholderforsearch' => [
|
|
||||||
'read',
|
|
||||||
'write',
|
|
||||||
'delete',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -4,6 +4,8 @@ use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
|
|||||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Eloquent\Support\Collection;
|
||||||
|
|
||||||
class CategoryRepository extends EntryRepository implements CategoryRepositoryInterface
|
class CategoryRepository extends EntryRepository implements CategoryRepositoryInterface
|
||||||
{
|
{
|
||||||
@ -37,6 +39,39 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
|||||||
{
|
{
|
||||||
return $this->model->where('parent_category_id', null)->orderBy('sort_order')->get();
|
return $this->model->where('parent_category_id', null)->orderBy('sort_order')->get();
|
||||||
}
|
}
|
||||||
|
public function getLevel2Cats()
|
||||||
|
{
|
||||||
|
$dBName = 'default_cats_category';
|
||||||
|
$dBNamet = $dBName.'_translations';
|
||||||
|
|
||||||
|
$catsDB = DB::table((DB::raw($dBName.' c1')))
|
||||||
|
->select(
|
||||||
|
DB::raw('c1.id'),
|
||||||
|
DB::raw('c1.slug'),
|
||||||
|
DB::raw('c1.parent_category_id'),
|
||||||
|
DB::raw('t1.name'),
|
||||||
|
|
||||||
|
DB::raw('c2.id as c2_id'),
|
||||||
|
DB::raw('c2.slug as c2_slug'),
|
||||||
|
DB::raw('c2.parent_category_id as c2_parent_category_id'),
|
||||||
|
DB::raw('t2.name as c2_name')
|
||||||
|
)
|
||||||
|
->leftJoin((DB::raw($dBName.' c2')), DB::raw('c2.parent_category_id'), '=', DB::raw('c1.id'))
|
||||||
|
->leftJoin((DB::raw($dBNamet.' t1')), DB::raw('c1.id'), '=', DB::raw('t1.entry_id'))
|
||||||
|
->leftJoin((DB::raw($dBNamet.' t2')), DB::raw('c2.id'), '=', DB::raw('t2.entry_id'))
|
||||||
|
->where(DB::raw('t1.locale'), Request()->session()->get('_locale', setting_value('streams::default_locale')))
|
||||||
|
->where(DB::raw('t2.locale'), Request()->session()->get('_locale', setting_value('streams::default_locale')))
|
||||||
|
->where(DB::raw("c1.deleted_at"),NULL)
|
||||||
|
->where(DB::raw("c2.deleted_at"),NULL)
|
||||||
|
->whereNull(DB::raw("c1.parent_category_id"))
|
||||||
|
->orderBy(DB::raw("c1.sort_order"))
|
||||||
|
->orderBy(DB::raw("c2.sort_order"))
|
||||||
|
->get();
|
||||||
|
$cats = collect([]);
|
||||||
|
$cats->subcats = $catsDB;
|
||||||
|
$cats->maincats = $catsDB->unique('id');
|
||||||
|
return $cats;
|
||||||
|
}
|
||||||
|
|
||||||
public function getItem($cat)
|
public function getItem($cat)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace Visiosoft\CatsModule\Category\Command;
|
||||||
|
|
||||||
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
|
|
||||||
|
class getLevel2Cats
|
||||||
|
{
|
||||||
|
public function handle(CategoryRepositoryInterface $repo)
|
||||||
|
{
|
||||||
|
return $repo->getLevel2Cats();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,6 +8,8 @@ interface CategoryRepositoryInterface extends EntryRepositoryInterface
|
|||||||
|
|
||||||
public function mainCats();
|
public function mainCats();
|
||||||
|
|
||||||
|
public function getLevel2Cats();
|
||||||
|
|
||||||
public function getItem($cat);
|
public function getItem($cat);
|
||||||
|
|
||||||
public function getCatById($id);
|
public function getCatById($id);
|
||||||
|
|||||||
@ -29,12 +29,7 @@ class CatsModule extends Module
|
|||||||
'buttons' => [
|
'buttons' => [
|
||||||
'new_category',
|
'new_category',
|
||||||
],
|
],
|
||||||
],
|
]
|
||||||
'placeholderforsearch' => [
|
|
||||||
'buttons' => [
|
|
||||||
'new_placeholderforsearch',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
<?php namespace Visiosoft\CatsModule;
|
<?php namespace Visiosoft\CatsModule;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
||||||
|
use Anomaly\Streams\Platform\Image\Command\MakeImageInstance;
|
||||||
|
|
||||||
|
use Visiosoft\CatsModule\Category\Command\getLevel2Cats;
|
||||||
use Visiosoft\CatsModule\Category\CategoryModel;
|
use Visiosoft\CatsModule\Category\CategoryModel;
|
||||||
|
use Visiosoft\CatsModule\Category\CategoryRepository;
|
||||||
use Visiosoft\CatsModule\Category\Command\GetCategoryName;
|
use Visiosoft\CatsModule\Category\Command\GetCategoryName;
|
||||||
use Visiosoft\CatsModule\Category\Command\GetCategoryDetail;
|
use Visiosoft\CatsModule\Category\Command\GetCategoryDetail;
|
||||||
|
|
||||||
@ -38,7 +42,7 @@ class CatsModulePlugin extends Plugin
|
|||||||
'category_parents_name',
|
'category_parents_name',
|
||||||
function ($id) {
|
function ($id) {
|
||||||
$category_model = new CategoryModel();
|
$category_model = new CategoryModel();
|
||||||
return $category_model->getParentCats($id,'add_main');
|
return $category_model->getParentCats($id, 'add_main');
|
||||||
}
|
}
|
||||||
), new \Twig_SimpleFunction(
|
), new \Twig_SimpleFunction(
|
||||||
'getParentsCount',
|
'getParentsCount',
|
||||||
@ -46,6 +50,23 @@ class CatsModulePlugin extends Plugin
|
|||||||
$category_model = new CategoryModel();
|
$category_model = new CategoryModel();
|
||||||
return $category_model->getParentsCount($id);
|
return $category_model->getParentsCount($id);
|
||||||
}
|
}
|
||||||
|
), new \Twig_SimpleFunction(
|
||||||
|
'catIcon',
|
||||||
|
function ($path) {
|
||||||
|
if ($path == "") {
|
||||||
|
return $this->dispatch(new MakeImageInstance('visiosoft.theme.base::images/default-categories-icon.png', 'img'))->url();
|
||||||
|
} else {
|
||||||
|
return url('files/'.$path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
), new \Twig_SimpleFunction(
|
||||||
|
'getLevel2Cats',
|
||||||
|
function () {
|
||||||
|
if (!$getLevel2Cats = $this->dispatch(new getLevel2Cats())) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return $getLevel2Cats;
|
||||||
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<?php namespace Visiosoft\CatsModule;
|
<?php namespace Visiosoft\CatsModule;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchSeeder;
|
|
||||||
|
|
||||||
class CatsModuleSeeder extends Seeder
|
class CatsModuleSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@ -10,6 +9,6 @@ class CatsModuleSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$this->call(PlaceholderforsearchSeeder::class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,6 @@
|
|||||||
<?php namespace Visiosoft\CatsModule;
|
<?php namespace Visiosoft\CatsModule;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
|
use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\Contract\PlaceholderforsearchRepositoryInterface;
|
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchRepository;
|
|
||||||
use Anomaly\Streams\Platform\Model\Cats\CatsPlaceholderforsearchEntryModel;
|
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchModel;
|
|
||||||
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
|
||||||
use Visiosoft\CatsModule\Category\CategoryRepository;
|
use Visiosoft\CatsModule\Category\CategoryRepository;
|
||||||
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
|
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
|
||||||
@ -51,9 +47,7 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected $routes = [
|
protected $routes = [
|
||||||
'admin/cats/clean_subcats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@cleanSubcats',
|
'admin/cats/clean_subcats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@cleanSubcats',
|
||||||
'admin/cats/placeholderforsearch' => 'Visiosoft\CatsModule\Http\Controller\Admin\PlaceholderforsearchController@index',
|
|
||||||
'admin/cats/placeholderforsearch/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\PlaceholderforsearchController@create',
|
|
||||||
'admin/cats/placeholderforsearch/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\PlaceholderforsearchController@edit',
|
|
||||||
'admin/cats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@index',
|
'admin/cats' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@index',
|
||||||
'admin/cats/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create',
|
'admin/cats/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create',
|
||||||
'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit',
|
'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit',
|
||||||
@ -117,7 +111,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
* @type array|null
|
* @type array|null
|
||||||
*/
|
*/
|
||||||
protected $bindings = [
|
protected $bindings = [
|
||||||
CatsPlaceholderforsearchEntryModel::class => PlaceholderforsearchModel::class,
|
|
||||||
CatsCategoryEntryModel::class => CategoryModel::class,
|
CatsCategoryEntryModel::class => CategoryModel::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -127,7 +120,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
* @type array|null
|
* @type array|null
|
||||||
*/
|
*/
|
||||||
protected $singletons = [
|
protected $singletons = [
|
||||||
PlaceholderforsearchRepositoryInterface::class => PlaceholderforsearchRepository::class,
|
|
||||||
CategoryRepositoryInterface::class => CategoryRepository::class,
|
CategoryRepositoryInterface::class => CategoryRepository::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -202,18 +194,10 @@ class CatsModuleServiceProvider extends AddonServiceProvider
|
|||||||
'href' => '/admin/cats/create?parent='.$request->cat
|
'href' => '/admin/cats/create?parent='.$request->cat
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
]
|
||||||
'placeholderforsearch' => [
|
|
||||||
'buttons' => [
|
|
||||||
'new_placeholderforsearch',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
$this->addon->setSections($sections);
|
$this->addon->setSections($sections);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getOverrides();
|
return parent::getOverrides();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Http\Controller\Admin;
|
|
||||||
|
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\Form\PlaceholderforsearchFormBuilder;
|
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\Table\PlaceholderforsearchTableBuilder;
|
|
||||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
|
||||||
|
|
||||||
class PlaceholderforsearchController extends AdminController
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display an index of existing entries.
|
|
||||||
*
|
|
||||||
* @param PlaceholderforsearchTableBuilder $table
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function index(PlaceholderforsearchTableBuilder $table)
|
|
||||||
{
|
|
||||||
return $table->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new entry.
|
|
||||||
*
|
|
||||||
* @param PlaceholderforsearchFormBuilder $form
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function create(PlaceholderforsearchFormBuilder $form)
|
|
||||||
{
|
|
||||||
return $form->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit an existing entry.
|
|
||||||
*
|
|
||||||
* @param PlaceholderforsearchFormBuilder $form
|
|
||||||
* @param $id
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function edit(PlaceholderforsearchFormBuilder $form, $id)
|
|
||||||
{
|
|
||||||
return $form->render($id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Contract;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
|
||||||
|
|
||||||
interface PlaceholderforsearchInterface extends EntryInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Contract;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
|
||||||
|
|
||||||
interface PlaceholderforsearchRepositoryInterface extends EntryRepositoryInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Form;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
|
||||||
|
|
||||||
class PlaceholderforsearchFormBuilder extends FormBuilder
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form fields.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $fields = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional validation rules.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $rules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fields to skip.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $skips = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form buttons.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
|
||||||
'cancel',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form options.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form sections.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $sections = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The form assets.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
|
||||||
|
|
||||||
class PlaceholderforsearchCollection extends EntryCollection
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
|
||||||
|
|
||||||
class PlaceholderforsearchCriteria extends EntryCriteria
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\Contract\PlaceholderforsearchInterface;
|
|
||||||
use Anomaly\Streams\Platform\Model\Cats\CatsPlaceholderforsearchEntryModel;
|
|
||||||
|
|
||||||
class PlaceholderforsearchModel extends CatsPlaceholderforsearchEntryModel implements PlaceholderforsearchInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
|
||||||
|
|
||||||
class PlaceholderforsearchObserver extends EntryObserver
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
|
||||||
|
|
||||||
class PlaceholderforsearchPresenter extends EntryPresenter
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Visiosoft\CatsModule\Placeholderforsearch\Contract\PlaceholderforsearchRepositoryInterface;
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
|
||||||
|
|
||||||
class PlaceholderforsearchRepository extends EntryRepository implements PlaceholderforsearchRepositoryInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The entry model.
|
|
||||||
*
|
|
||||||
* @var PlaceholderforsearchModel
|
|
||||||
*/
|
|
||||||
protected $model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new PlaceholderforsearchRepository instance.
|
|
||||||
*
|
|
||||||
* @param PlaceholderforsearchModel $model
|
|
||||||
*/
|
|
||||||
public function __construct(PlaceholderforsearchModel $model)
|
|
||||||
{
|
|
||||||
$this->model = $model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
|
||||||
|
|
||||||
class PlaceholderforsearchRouter extends EntryRouter
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class PlaceholderforsearchSeeder extends Seeder
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the seeder.
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
DB::table('cats_placeholderforsearch')->truncate();
|
|
||||||
DB::table('cats_placeholderforsearch_translations')->truncate();
|
|
||||||
PlaceholderforsearchModel::create([
|
|
||||||
'en' => [
|
|
||||||
'name' => 'Chevrolet Camaro'
|
|
||||||
],
|
|
||||||
'tr' => [
|
|
||||||
'name' => 'Chevrolet Camaro'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
PlaceholderforsearchModel::create([
|
|
||||||
'en' => [
|
|
||||||
'name' => 'Xiaomi Black Shark 128 GB'
|
|
||||||
],
|
|
||||||
'tr' => [
|
|
||||||
'name' => 'Xiaomi Black Shark 128 GB'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
PlaceholderforsearchModel::create([
|
|
||||||
'en' => [
|
|
||||||
'name' => 'Apple MacBook Pro'
|
|
||||||
],
|
|
||||||
'tr' => [
|
|
||||||
'name' => 'Apple MacBook Pro'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
PlaceholderforsearchModel::create([
|
|
||||||
'en' => [
|
|
||||||
'name' => 'Make your search now'
|
|
||||||
],
|
|
||||||
'tr' => [
|
|
||||||
'name' => 'Make your search now'
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Table;
|
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
|
||||||
|
|
||||||
class PlaceholderforsearchTableBuilder extends TableBuilder
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table views.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $views = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table filters.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $filters = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table columns.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $columns = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table buttons.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $buttons = [
|
|
||||||
'edit'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table actions.
|
|
||||||
*
|
|
||||||
* @var array|string
|
|
||||||
*/
|
|
||||||
protected $actions = [
|
|
||||||
'delete'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table options.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $options = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table assets.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $assets = [];
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user