refactoring cats module

This commit is contained in:
vedatakd 2020-09-12 17:33:01 +03:00
parent 8851bae78f
commit dcb03ef9be
43 changed files with 301 additions and 982 deletions

View File

@ -12,7 +12,7 @@
</a>
</li>
{{ addBlock('ads-list/partials/breadcrumb',{'mainCats': mainCats, 'category': categoryId})|raw }}
{{ addBlock('ads-list/partials/breadcrumb',{'mainCats': mainCats, 'category': category})|raw }}
</ol>
</nav>

View File

@ -39,7 +39,7 @@
'neighborhoods':neighborhoods,
'villages':villages,
'param':param,
'categoryId':categoryId,
'category':category,
'cityId':cityId,
'_ORDER_':['visiosoft.module.cats', 'visiosoft.module.location']
})|raw }}

View File

@ -10,7 +10,7 @@ use Intervention\Image\Facades\Image;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
use Visiosoft\CatsModule\Category\CategoryModel;
use Visiosoft\AdvsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\LocationModule\Country\CountryModel;
@ -34,6 +34,9 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
*/
private $folderRepository;
public $categoryRepository;
/**
* Create a new AdvRepository instance.
*
@ -43,13 +46,15 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
AdvModel $model,
SettingRepositoryInterface $settings,
FileRepositoryInterface $fileRepository,
FolderRepositoryInterface $folderRepository
FolderRepositoryInterface $folderRepository,
CategoryRepositoryInterface $categoryRepository
)
{
$this->model = $model;
$this->settings = $settings;
$this->fileRepository = $fileRepository;
$this->folderRepository = $folderRepository;
$this->categoryRepository = $categoryRepository;
}
/**
@ -112,16 +117,7 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
}
}
if ($category) {
$cat = new CategoryModel();
if ($category) {
if ($category->parent_category_id == null) {
$catLevel = 1;
} else {
$catLevel = $cat->getCatLevel($category->id);
}
$catLevel = "cat" . $catLevel;
$query = $query->where($catLevel, $category->id);
}
$query = $this->categoryRepository->setQuerySearchingAds($query, $category);
}
if (!empty($param['user'])) {
$query = $query->where('advs_advs.created_by_id', $param['user']);
@ -265,20 +261,11 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
public function getCatNames($adv)
{
$cat1 = CategoryModel::query()->where('cats_category.id', $adv->cat1)->first();
$cat2 = CategoryModel::query()->where('cats_category.id', $adv->cat2)->first();
if (!is_null($cat1))
$adv->setAttribute('cat1_name', $cat1->name);
else
$adv->setAttribute('cat1_name', "");
if (!is_null($cat2))
$adv->setAttribute('cat2_name', $cat2->name);
else
$adv->setAttribute('cat2_name', "");
$cat1 = $this->categoryRepository->find($adv->cat1);
$cat2 = $this->categoryRepository->find($adv->cat2);
$adv->setAttribute('cat1_name', ($cat1) ? $cat1->name : "");
$adv->setAttribute('cat2_name', ($cat2) ? $cat2->name : "");
return $adv;
}
@ -301,9 +288,9 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
public function addAttributes($advs)
{
foreach ($advs as $adv) {
$adv = $this->getLocationNames($adv);
$adv = $this->getCatNames($adv);
foreach ($advs as $key => $adv) {
$advs[$key] = $this->getLocationNames($adv);
$advs[$key] = $this->getCatNames($adv);
}
return $advs;

View File

@ -0,0 +1,32 @@
<?php namespace Visiosoft\AdvsModule\Adv\Listener;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\CatsModule\Category\Events\DeletedCategory;
class CategoryDeleted
{
public $advRepository;
public function __construct(AdvRepositoryInterface $advRepository)
{
$this->advRepository = $advRepository;
}
public function handle(DeletedCategory $event)
{
$category = $event->getCategory();
$catLevelNum = ($category->parent_category_id) ? count($event->getParents()) : 1;
$catLevelText = "cat" . $catLevelNum;
$advs = $this->advRepository->newQuery()->where($catLevelText, $category->id)->get();
foreach ($advs as $adv) {
$nullableCats = array();
for ($i = $catLevelNum; $i <= 10; $i++) {
$nullableCats['cat' . $i] = null;
}
$adv->update($nullableCats);
}
}
}

View File

@ -10,11 +10,13 @@ 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\Listener\CategoryDeleted;
use Visiosoft\AdvsModule\Http\Middleware\redirectDiffrentLang;
use Visiosoft\AdvsModule\Http\Middleware\SetLang;
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
use Visiosoft\AdvsModule\Option\OptionRepository;
use Visiosoft\CatsModule\Category\Events\DeletedCategory;
use Visiosoft\LocationModule\Village\Contract\VillageRepositoryInterface;
use Visiosoft\LocationModule\Village\VillageRepository;
use Visiosoft\LocationModule\Village\VillageModel;
@ -178,6 +180,9 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
TableIsQuerying::class => [
AddAdvsSettingsScript::class,
],
DeletedCategory::class => [
CategoryDeleted::class
],
];
/**

View File

@ -19,6 +19,7 @@ use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
use Visiosoft\CatsModule\Category\CategoryModel;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\AlgoliaModule\Search\SearchModel;
@ -134,9 +135,9 @@ class AdvsController extends AdminController
'value' => 'entry.created_by.name'
],
'category' => [
'value' => function (EntryInterface $entry, CategoryModel $categoryModel) {
$category = $categoryModel->getCat($entry->cat1);
if (!is_null($category))
'value' => function (EntryInterface $entry, CategoryRepositoryInterface $categoryRepository) {
$category = $categoryRepository->find($entry->cat1);
if ($category)
return $category->name;
}
],

View File

@ -5,6 +5,7 @@ use Anomaly\UsersModule\User\UserModel;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Illuminate\Http\Request;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\LocationModule\City\CityModel;
use Visiosoft\LocationModule\District\DistrictModel;
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
@ -50,12 +51,12 @@ class AjaxController extends PublicController
return response()->json($datas);
}
public function keySearch(Request $request)
public function keySearch(Request $request, CategoryRepositoryInterface $categoryRepository)
{
$datas = [];
$catModel = new CategoryModel();
$datas['category'] = $catModel->searchKeyword($request->q, $request->selected);
return response()->json($datas);
$response = [
'category' => $categoryRepository->searchKeyword($request->q, $request->selected)
];
return response()->json($response);
}
public function viewed(AdvModel $advModel, $id)
@ -75,7 +76,7 @@ class AjaxController extends PublicController
$my_advs = $my_advs->myAdvsByUser();
}
$my_advs = $my_advs->select(['id', 'cover_photo', 'slug', 'price', 'currency', 'city', 'country_id', 'cat1', 'cat2', 'status'])
->orderByDesc('id');
->orderByDesc('id');
$my_advs = $advRepository->addAttributes($my_advs->get());
foreach ($my_advs as $index => $ad) {

View File

@ -135,10 +135,9 @@ class AdvsController extends PublicController
$isActiveDopings = $this->adv_model->is_enabled('dopings');
// Search by category slug
$categoryId = null;
if ($category) { // Slug
$categoryId = $this->category_repository->findBy('slug', $category);
if (!$categoryId) {
$category = $this->category_repository->findBy('slug', $category);
if (!$category) {
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
return redirect('/');
}
@ -146,20 +145,20 @@ class AdvsController extends PublicController
unset($param['cat']);
return redirect($this->fullLink(
$param,
route('adv_list_seo', [$categoryId->slug]),
route('adv_list_seo', [$category->slug]),
array()
));
}
} elseif (isset($param['cat']) && !empty($param['cat'])) { // Only Param
$categoryId = $this->category_repository->find($param['cat']);
if (!$categoryId) {
$category = $this->category_repository->find($param['cat']);
if (!$category) {
$this->messages->error(trans('visiosoft.module.advs::message.category_not_exist'));
return redirect('/');
}
unset($param['cat']);
return redirect($this->fullLink(
$param,
route('adv_list_seo', [$categoryId->slug]),
route('adv_list_seo', [$category->slug]),
array()
));
}
@ -179,7 +178,7 @@ class AdvsController extends PublicController
unset($param['city']);
return redirect($this->fullLink(
$param,
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
route('adv_list_seo', [$category->slug, $cityId->slug]),
array()
));
} elseif ($isOneCity) { // Param and slug
@ -188,14 +187,14 @@ class AdvsController extends PublicController
unset($param['city']);
return redirect($this->fullLink(
$param,
route('adv_list_seo', [$categoryId->slug, $cityId->slug]),
route('adv_list_seo', [$category->slug, $cityId->slug]),
array()
));
}
} elseif ($city && $isMultipleCity) { // Slug and multiple param cities
return redirect($this->fullLink(
$param,
route('adv_list_seo', [$categoryId->slug]),
route('adv_list_seo', [$category->slug]),
array()
));
} elseif ($city) {
@ -203,7 +202,7 @@ class AdvsController extends PublicController
unset($param['city']);
return redirect($this->fullLink(
$param,
route('adv_list_seo', [$categoryId->slug]),
route('adv_list_seo', [$category->slug]),
array()
));
} else { // Only slug
@ -213,7 +212,7 @@ class AdvsController extends PublicController
}
$isActiveCustomFields = $this->adv_model->is_enabled('customfields');
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters, null, $categoryId, $cityId);
$advs = $this->adv_repository->searchAdvs('list', $param, $customParameters, null, $category, $cityId);
$advs = $this->adv_repository->addAttributes($advs);
if ($isActiveDopings and $param != null) {
@ -233,27 +232,22 @@ class AdvsController extends PublicController
}
if ($categoryId) {
$seo_keywords = $this->category_model->getMeta_keywords($categoryId->id);
$seo_description = $this->category_model->getMeta_description($categoryId->id);
$seo_title = $this->category_model->getMeta_title($categoryId->id);
if ($category) {
$this->template->set('og_description', $category->seo_description);
$this->template->set('meta_description', $category->seo_description);
$this->template->set('meta_title', $category->name);
$this->template->set('meta_keywords', implode(', ', $category->seo_keyword));
$this->template->set('og_description', $seo_description);
$this->template->set('meta_description', $seo_description);
$this->template->set('meta_title', $seo_title);
$this->template->set('meta_keywords', implode(', ', $seo_keywords));
$mainCats = $this->category_repository->getParents($category->id);
$mainCats = $this->category_model->getMains($categoryId->id);
$current_cat = $this->category_model->getCat($categoryId->id);
$mainCats[] = [
'id' => $current_cat->id,
'val' => $current_cat->name,
'slug' => $current_cat->slug,
];
$subCats = $this->category_repository->getSubCatById($categoryId->id);
$subCats = $this->category_repository->getSubCategories($category->id);
} else {
$mainCats = $this->category_repository->mainCats();
$allCats = true;
$mainCats = $this->category_repository->getMainCategories();
$meta_title = $this->category_repository->getCategoryTextSeo($mainCats);
$this->template->set('showTitle', false);
$this->template->set('meta_title', $meta_title);
}
if ($isActiveCustomFields) {
@ -271,21 +265,6 @@ class AdvsController extends PublicController
$viewType = $this->requestHttp->cookie('viewType');
if (!isset($allCats)) {
if (count($mainCats) == 1 || count($mainCats) == 2) {
$catText = end($mainCats)['val'];
} elseif (count($mainCats) > 2) {
$catArray = array_slice($mainCats, 2);
$catText = '';
$loop = 0;
foreach ($catArray as $cat) {
$catText = !$loop ? $catText . $cat['val'] : $catText . ' ' . $cat['val'];
$loop++;
}
}
$this->template->set('showTitle', false);
$this->template->set('meta_title', $catText);
}
if (!empty($param['user'])) {
$user = $this->userRepository->find($param['user']);
@ -295,7 +274,7 @@ class AdvsController extends PublicController
$compact = compact('advs', 'countries', 'mainCats', 'subCats', 'checkboxes', 'request', 'param',
'user', 'featured_advs', 'viewType', 'topfields', 'selectDropdown', 'selectRange', 'selectImage', 'ranges',
'seenList', 'searchedCountry', 'radio', 'categoryId', 'cityId', 'allCats', 'catText');
'seenList', 'searchedCountry', 'radio', 'category', 'cityId', 'allCats', 'catText');
return $this->viewTypeBasedRedirect($viewType, $compact);
}
@ -351,7 +330,7 @@ class AdvsController extends PublicController
for ($i = 1; $i <= 10; $i++) {
$cat = "cat" . $i;
if ($adv->$cat != null) {
$item = $this->category_repository->getItem($adv->$cat);
$item = $this->category_repository->find($adv->$cat);
if (!is_null($item)) {
$categories['cat' . $i] = [
'name' => $item->name,
@ -427,7 +406,7 @@ class AdvsController extends PublicController
for ($i = 1; $i <= 10; $i++) {
$cat = "cat" . $i;
if ($adv->$cat != null) {
$item = $this->category_repository->getItem($adv->$cat);
$item = $this->category_repository->find($adv->$cat);
if (!is_null($item)) {
$categories['cat' . $i] = [
'name' => $item->name,
@ -467,12 +446,18 @@ class AdvsController extends PublicController
return back();
}
public function getCats($id)
{
return $this->category_repository->getSubCatById($id);
}
public function getCatsForNewAd($id)
{
if ($this->adv_model->is_enabled('packages')) {
$cats = app('Visiosoft\PackagesModule\Http\Controller\PackageFEController')->AdLimitForCategorySelection($id);
} else {
$cats = $this->category_repository->getSubCatById($id);
$cats = $this->getCats($id);
if (empty($cats->toArray())) {
$cats = trans('visiosoft.module.advs::message.create_ad_with_post_cat');
@ -499,7 +484,7 @@ class AdvsController extends PublicController
for ($i = 0; $i < $end; $i++) {
$plus1 = $i + 1;
$cat = $repository->getSingleCat($cats['cat' . $plus1]);
$cat = $repository->find($cats['cat' . $plus1]);
$cats_d['cat' . $plus1] = $cat->name;
}
if ($isActive->is_enabled('customfields')) {
@ -619,7 +604,7 @@ class AdvsController extends PublicController
foreach ($cats as $para => $value) {
if (substr($para, 0, 3) === "cat") {
$id = $cats[$para];
$cat = $this->category_repository->getSingleCat($id);
$cat = $categoryRepository->find($id);
if ($cat != null) {
$cats_d[$para] = $cat->name;
}
@ -659,7 +644,7 @@ class AdvsController extends PublicController
for ($i = 1; $i <= 10; $i++) {
if ($adv[$cat . $i]) {
$name = $this->category_repository->getSingleCat($adv[$cat . $i]);
$name = $this->category_repository->find($adv[$cat . $i]);
if ($name) {
$cats_d['cat' . $i] = $name->name;
$cats['cat' . $i] = $name->id;
@ -740,7 +725,7 @@ class AdvsController extends PublicController
{
$mainCats = $this->category_repository->mainCats();
return $this->view->make('visiosoft.module.advs::new-ad/post-cat', compact('mainCats'));
return $this->view->make('visiosoft.module.advs::new-ad/post-cat', compact('main_cats'));
}
public function editCategoryForAd($id)

View File

@ -37,7 +37,6 @@ class VisiosoftModuleCatsCreateCatsFields extends Migration
],
'seo_keyword' => 'anomaly.field_type.tags',
'seo_description' => 'anomaly.field_type.text',
];
}

View File

@ -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,
],
];
}

View File

@ -1,8 +1,8 @@
{% if params.category %}
{% for category_breadcrumbs in params.mainCats %}
<li class="breadcrumb-item">
<a href="{{ url_route('adv_list_seo', [category_breadcrumbs['slug']]) }}"
class="text-dark font-weight-bold">{{ category_breadcrumbs['val'] }}
<a href="{{ url_route('adv_list_seo', [category_breadcrumbs.slug]) }}"
class="text-dark font-weight-bold">{{ category_breadcrumbs.name }}
</a>
</li>
{% endfor %}

View File

@ -10,45 +10,40 @@
</div>
<div id="category" class="collapse show overflow-auto" aria-labelledby="categoryHeading" style="max-height: 300px;">
<div class="list-group">
{% for maincat in params.mainCats %}
{% set name = maincat['val'] %}
{% set id = maincat['id'] %}
{% set parent_category = true %}
{% if app.request.get('cat') is null or app.request.get('cat') == "" %}
{% if params.categoryId is null %}
{% set name = maincat.name %}
{% set id = maincat.id %}
{% set parent_category = false %}
{% endif %}
{% endif %}
{% set catId = entries('cats', 'category').find(id) %}
{% for maincat in params.mainCats|reverse %}
{% set citySlug = null %}
{% set pathInfo = app.request.pathinfo|split('/') %}
{% if pathInfo|length is same as(4) %}
{% set citySlug = pathInfo[3] %}
{% endif %}
<a href="{% if(viewType != "map") %}
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [catId.slug, citySlug]),{},['page']) }}
{% else %}
{{ appendRequestURL(request_query(),url_route('adv_list_seo'),{'cat':id},['page']) }}
{% endif %}" class="list-group-item list-group-item-action text-truncate">
{% set url = appendRequestURL(request_query(),url_route('adv_list_seo', [maincat.slug, citySlug]),{},['page']) %}
{% if viewType == "map" %}
{% set url = appendRequestURL(request_query(),url_route('adv_list_seo'),{'cat':maincat.id},['page']) %}
{% endif %}
<a href="{{ url }}" class="list-group-item list-group-item-action text-truncate">
<i class="fas fa-dot-circle"></i>
{{ name }}
{{ maincat.name }}
</a>
{% for subcat in params.subCats %}
<div class="list-group pl-3 bg-light">
{% if subcat.parent_category_id == maincat['id'] %}
{% set subCatId = entries('cats', 'category').find(subcat.id) %}
<a href="{% if(viewType != "map") %}
{{ appendRequestURL(request_query(),url_route('adv_list_seo', [subCatId.slug, citySlug]),{},['page']) }}
{% else %}
{{ appendRequestURL(request_query(),url_route('adv_list_seo'),{'cat':subcat.id},['page']) }}
{% endif %}" class="list-group-item list-group-item-action text-truncate">
{% if maincat.id == params.category.id %}
{% for subcat in params.subCats %}
<div class="list-group pl-3 bg-light">
{% set url = appendRequestURL(request_query(),url_route('adv_list_seo', [subcat.slug, citySlug]),{},['page']) %}
{% if viewType == "map" %}
{% set url = appendRequestURL(request_query(),url_route('adv_list_seo'),{'cat':subcat.id},['page']) %}
{% endif %}
<a href="{{ url }}" class="list-group-item list-group-item-action text-truncate">
{{ subcat.name }}
</a>
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>

View File

@ -8,15 +8,15 @@
{{ asset_add("scripts.js", "streams::js/table/sortable.js") }}
{% endif %}
{% if app.request.get('cat') != null %}
{% set parent = category_detail(app.request.get('cat')) %}
{% set parent = findCategory(app.request.get('cat')) %}
{% if parent.parent_category is null %}
{% set parent_url = url('admin/cats') %}
{% else %}
{% set parent_url = url('admin/cats?cat='~parent.parent_category_id) %}
{% endif %}
<ol class="breadcrumb">
{% for parnt in category_parents_name(app.request.get('cat'))|reverse %}
<li class="breadcrumb-item"><a><b>{{ parnt }}</b></a></li>
{% for parent in getParents(app.request.get('cat'))|reverse %}
<li class="breadcrumb-item"><a><b>{{ parent.name }}</b></a></li>
{% endfor %}
</ol>
<div class="container-fluid">

View File

@ -20,7 +20,7 @@ class CategoryCriteria extends EntryCriteria
}
public function getMainCats() {
$mainCats = $this->categoryRepository->mainCats();
$mainCats = $this->categoryRepository->getMainCategories();
foreach ($mainCats as $cat) {
$subCount = $this->categoryRepository->newQuery()->where('parent_category_id', $cat->id)->count();

View File

@ -1,191 +1,8 @@
<?php namespace Visiosoft\CatsModule\Category;
use Illuminate\Support\Facades\DB;
use Visiosoft\CatsModule\Category\Contract\CategoryInterface;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
{
public function getCat($id)
{
return CategoryModel::query()
->where('cats_category.id', $id)
->whereRaw('deleted_at IS NULL')
->first();
}
public function getParentCats($id, $type = null)
{
$cat = $this->getCat($id);
$catNames = array();
$cat_ids = array();
$catNames[] = $cat->name;
$cat_ids[] = $cat->id;
$subCat = $cat->parent_category_id;
if ($subCat != null) {
for ($i = 0; $i < 10; $i++) {
$parCat = $this->getCat($subCat);
if (isset($parCat)) {
if ($parCat->parent_category_id == "") {
if ($type == "add_main")
$catNames[] = $parCat->name;
break;
}
$catNames[] = $parCat->name;
$cat_ids[] = $parCat->id;
$subCat = $parCat->parent_category_id;
}
}
}
if ($type == 'category_ids') {
return CategoryModel::query()
->whereIn('cats_category.id', $cat_ids)
->whereRaw('deleted_at IS NULL')
->orderBy('cats_category.id', 'asc')
->get();
}
if ($type == "parent_id") {
$cat_ids = array_reverse($cat_ids);
return $cat_ids[0];
}
return $catNames;
}
public function getCatLevel($id)
{
//count parent and itself
return count($this->getParentCats($id)) + 1;
}
public function getParentsCount($id)
{
$parentCats = array();
$currentId = $id;
do {
$cat = $this->getCat($currentId);
$catParent = $cat->parent_category_id;
if ($catParent) {
$currentId = $catParent;
$parentCats[] = $catParent;
}
} while ($catParent);
return count($parentCats);
}
public function getSubCategories($id, $get = null)
{
$sub_categories = $this->where('parent_category_id', $id)->get();
if ($get == 'id') {
$list_categories_id = array();
foreach ($sub_categories as $item_category) {
$list_categories_id[] = $item_category->id;
}
return $list_categories_id;
}
return $sub_categories;
}
public function getAllSubCategories($id)
{
$sub = $this->getSubCategories($id, 'id');
for ($i = 0; $i <= count($sub) - 1; $i++) {
$sub = array_merge($sub, $this->getSubCategories($sub[$i], 'id'));
}
return $sub;
}
public function deleteSubCategories($id)
{
$subCategories = $this->getAllSubCategories($id);
if (count($subCategories)) {
$this->newQuery()->whereIn('id', $subCategories)->delete();
}
return true;
}
public function searchKeyword($keyword, $selected = null)
{
$data = [];
$cats = DB::table('cats_category');
if ($selected != null) {
if (strpos($selected, "-") !== false) {
$selected = explode('-', $selected);
$cats = $cats->whereNotIn('cats_category.id', $selected);
} else {
$cats = $cats->where('cats_category.id', '!=', $selected);
}
}
$cats = $cats->where('name', 'like', $keyword . '%')
->whereRaw('deleted_at IS NULL');
$cats = $cats->leftJoin('cats_category_translations', function ($join) {
$join->on('cats_category.id', '=', 'cats_category_translations.entry_id');
$join->whereIn('cats_category_translations.locale', [config('app.locale'), setting_value('streams::default_locale'),'en']);//active lang
});
$cats = $cats->select('cats_category.*', 'cats_category_translations.name as name');
$cats = $cats->orderBy('id', 'DESC')
->groupBy(['cats_category.id'])
->get();
foreach ($cats as $cat) {
$link = '';
$parents = $this->getParentCats($cat->id, null);
krsort($parents);
foreach ($parents as $key => $parent) {
if ($key == 0) {
$link .= $parent . '';
} else {
$link .= $parent . ' > ';
}
}
$data[] = array(
'id' => $cat->id,
'name' => $cat->name,
'parents' => $link
);
}
return $data;
}
public function getMainCategory()
{
return $this->where('parent_category_id', NULL)->get();
}
public function getMeta_keywords($cat_id)
{
return $this->find($cat_id)->seo_keyword;
}
public function getMeta_description($cat_id)
{
return $this->find($cat_id)->seo_description;
}
public function getMeta_title($cat_id)
{
return $this->find($cat_id)->name;
}
public function getMains($id)
{
$categories = array();
$z = 1;
for ($i = 1; $i <= $z; $i++) {
$main = $this->newQuery()->where('id', $id)->first();
$new = array();
$new['id'] = $main->id;
$new['val'] = $main->name;
$new['slug'] = $main->slug;
$categories[] = $new;
if ($main->parent_category_id != null) {
$id = $main->parent_category_id;
$z++;
}
}
$categories = array_reverse($categories);
unset($categories[count($categories) - 1]);
return $categories;
}
}

View File

@ -1,30 +1,8 @@
<?php namespace Visiosoft\CatsModule\Category;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
class CategoryPresenter extends EntryPresenter
{
public function getAdvsListUrl($attributes)
{
return \route('visiosoft.module.advs::list', "cat=" . $attributes);
}
public function getCategoryName($id)
{
$category = $this->find($id);
return $category->name;
}
public function getname($id)
{
$cat = CatsCategoryEntryModel::query()->find($id);
return $cat->name;
}
public function getMains($id)
{
$category_model = new CategoryModel();
return $category_model->getMains($id);
}
}

View File

@ -1,9 +1,9 @@
<?php namespace Visiosoft\CatsModule\Category;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Anomaly\Streams\Platform\Entry\EntryRepository;
use Visiosoft\CatsModule\Category\Events\DeletedCategory;
class CategoryRepository extends EntryRepository implements CategoryRepositoryInterface
{
@ -14,7 +14,6 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
* @var CategoryModel
*/
protected $model;
protected $advRepository;
/**
* Create a new CategoryRepository instance.
@ -22,38 +21,64 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
* @param CategoryModel $model
* @param AdvRepositoryInterface $advRepository
*/
public function __construct(CategoryModel $model, AdvRepositoryInterface $advRepository)
public function __construct(CategoryModel $model)
{
$this->model = $model;
$this->advRepository = $advRepository;
}
public function findById($id)
public function deleteSubCategories($id)
{
return $this->model->orderBy('created_at', 'DESC')->where('cats_category.id', $id)->first();
$sub = $this->getSubCategories($id);
for ($i = 0; $i <= count($sub) - 1; $i++) {
$sub = array_merge($sub, $this->getSubCategories($sub[$i]));
}
if (count($sub)) {
$this->newQuery()->whereIn('id', $sub)->delete();
}
return true;
}
public function mainCats()
public function deleteCategories($id)
{
return $this->newQuery()
->whereNull('parent_category_id')
->orderBy('sort_order')
if ($category = $this->find($id)) {
$category->delete();
event(new DeletedCategory($category, $this->getParents($id)));
$this->deleteSubCategories($id);
}
}
public function skipAndTake($take, $skip)
{
$this->newQuery()
->skip($take * $skip)
->take($take)
->get();
}
public function getItem($cat)
public function getParents($id)
{
return $this->model->where('cats_category.id', $cat)->first();
$category = $this->find($id);
$z = 1;
$categories = [$category];
for ($i = 0; $i < $z; $i++) {
if ($category = $this->find($category->parent_category_id)) {
$categories[] = $category;
if (!$category->parent_category_id) {
break;
}
$z++;
}
}
return $categories;
}
public function getCatById($id)
public function getSubCategories($id)
{
return $this->model->where('cats_category.id', $id)->where('deleted_at', null)->orderBy('sort_order')->get();
}
public function getSubCatById($id)
{
$cats = $this->model->newQuery()
$cats = $this->newQuery()
->where('parent_category_id', $id)
->get();
@ -61,54 +86,67 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
$subCount = $this->model->newQuery()->where('parent_category_id', $cat->id)->count();
$cat->hasChild = !!$subCount;
}
return $cats;
}
public function getSingleCat($id)
public function getMainCategories()
{
return CatsCategoryEntryModel::query()->where('cats_category.id', $id)->first();
return $this->newQuery()->whereNull('parent_category_id')->get();
}
public function findBySlug($slug)
public function getCategoryTextSeo($categories)
{
return $this->model->orderBy('created_at', 'DESC')->where('slug', $slug)->first();
}
public function getCategories()
{
return $this->model->orderBy('sort_order')->get();
}
public function removeCatFromAds($category)
{
$catLevelNum = 1;
if (!is_null($category->parent_category_id)) {
$catLevelNum = $this->model->getCatLevel($category->id);
}
$catLevelText = "cat" . $catLevelNum;
$advs = $this->advRepository->newQuery()->where($catLevelText, $category->id)->get();
foreach ($advs as $adv) {
$nullableCats = array();
for ($i = $catLevelNum; $i <= 10; $i++) {
$nullableCats['cat' . $i] = null;
if (count($categories) == 1 || count($categories) == 2) {
$catText = end($mainCats)['name'];
} elseif (count($categories) > 2) {
$catArray = array_slice($categories->toArray(), 2);
$catText = '';
$loop = 0;
foreach ($catArray as $cat) {
$catText = !$loop ? $catText . $cat['name'] : $catText . ' ' . $cat['name'];
$loop++;
}
$adv->update($nullableCats);
}
}
public function DeleteCategories($id)
public function setQuerySearchingAds($query, $category)
{
if (!is_null($category = $this->find($id))) {
// Remove deleted category from ads
$this->removeCatFromAds($category);
$catLevel = "cat" . (!$category->parent_category_id) ? 1 : count($this->getParents($category->id));
// Delete the category
$this->model->find($id)->delete();
return $query->where($catLevel, $category->id);
}
// Delete the subcategories
$this->model->deleteSubCategories($id);
public function searchKeyword($keyword, $selected = null)
{
$data = [];
$cats = $this->newQuery();
if ($selected) {
if (strpos($selected, "-") !== false) {
$cats = $cats->whereNotIn('id', explode('-', $selected));
} else {
$cats = $cats->where('id', '!=', $selected);
}
}
$cats = $cats->where('name', 'like', $keyword . '%')
->orderBy('id', 'DESC')
->get();
foreach ($cats as $cat) {
$link = '';
$parents = $this->getParents($cat->id);
krsort($parents);
foreach ($parents as $key => $parent) {
$link .= ($key == 0) ? $parent->name . '' : $parent->name . ' > ';
}
$data[] = array(
'id' => $cat->id,
'name' => $cat->name,
'parents' => $link
);
}
return $data;
}
}

View File

@ -1,38 +0,0 @@
<?php namespace Visiosoft\CatsModule\Category\Command;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
class GetCategoryDetail
{
/**
* @var $id
*/
protected $id;
/**
* GetProduct constructor.
* @param $id
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* @param CategoryRepositoryInterface $groups
* @return |null
*/
public function handle(CategoryRepositoryInterface $groups)
{
if ($this->id) {
$category = $groups->find($this->id);
if (!is_null($category))
return $category;
else
return null;
}
return null;
}
}

View File

@ -1,38 +0,0 @@
<?php namespace Visiosoft\CatsModule\Category\Command;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
class GetCategoryName
{
/**
* @var $id
*/
protected $id;
/**
* GetProduct constructor.
* @param $id
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* @param CategoryRepositoryInterface $groups
* @return |null
*/
public function handle(CategoryRepositoryInterface $groups)
{
if ($this->id) {
$category = $groups->find($this->id);
if (!is_null($category))
return $category->name;
else
return null;
}
return null;
}
}

View File

@ -4,21 +4,21 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface CategoryRepositoryInterface extends EntryRepositoryInterface
{
public function findById($id);
public function deleteSubCategories($id);
public function mainCats();
public function deleteCategories($id);
public function getItem($cat);
public function skipAndTake($take, $skip);
public function getCatById($id);
public function getParents($id);
public function getSubCatById($id);
public function getSubCategories($id);
public function getSingleCat($id);
public function getMainCategories();
public function findBySlug($slug);
public function getCategoryTextSeo($categories);
public function getCategories();
public function setQuerySearchingAds($query, $category);
public function DeleteCategories($id);
public function searchKeyword($keyword, $selected = null);
}

View File

@ -0,0 +1,25 @@
<?php namespace Visiosoft\CatsModule\Category\Events;
class DeletedCategory
{
public $category;
public $parents;
public function __construct($category, $parents)
{
$this->category = $category;
$this->parents = $parents;
}
public function getCategory()
{
return $this->category;
}
public function getParents()
{
$this->getParents();
}
}

View File

@ -5,62 +5,4 @@ use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
class CategoryFormBuilder 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 = [];
}

View File

@ -19,15 +19,6 @@ class CategoryTableBuilder extends TableBuilder
],
];
/**
* The table filters.
*
* @var array|string
*/
protected $filters = [
];
/**
* The table columns.
*

View File

@ -2,14 +2,10 @@
use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\CatsModule\Category\Table\CategoryTableBuilder;
class Delete extends ActionHandler
{
public function handle(
CategoryTableBuilder $builder, array $selected,
CategoryRepositoryInterface $categoryRepository
)
public function handle(array $selected, CategoryRepositoryInterface $categoryRepository)
{
try {
foreach ($selected as $id) {

View File

@ -30,11 +30,6 @@ class CatsModule extends Module
'new_category',
],
],
'placeholderforsearch' => [
'buttons' => [
'new_placeholderforsearch',
],
],
];
}

View File

@ -1,50 +1,32 @@
<?php namespace Visiosoft\CatsModule;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\CatsModule\Category\CategoryModel;
use Visiosoft\CatsModule\Category\Command\GetCategoryName;
use Visiosoft\CatsModule\Category\Command\GetCategoryDetail;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
class CatsModulePlugin extends Plugin
{
public $categoryRepository;
public function __construct(CategoryRepositoryInterface $categoryRepository)
{
$this->categoryRepository = $categoryRepository;
}
/**
* @return array
*/
public function getFunctions()
{
return [
new \Twig_SimpleFunction(
'category_name',
'findCategory',
function ($id) {
if (!$ad = $this->dispatch(new GetCategoryName($id))) {
if (!$category = $this->categoryRepository->find($id)) {
return null;
}
return $ad;
return $category;
}
), new \Twig_SimpleFunction(
'category_detail',
'getParents',
function ($id) {
if (!$ad = $this->dispatch(new GetCategoryDetail($id))) {
return null;
}
return $ad;
}
), new \Twig_SimpleFunction(
'category_parents_name',
function ($id) {
$category_model = new CategoryModel();
return $category_model->getParentCats($id,'add_main');
}
), new \Twig_SimpleFunction(
'getParentsCount',
function ($id) {
$category_model = new CategoryModel();
return $category_model->getParentsCount($id);
return $this->categoryRepository->getParents($id);
}
)
];

View File

@ -1,7 +1,6 @@
<?php namespace Visiosoft\CatsModule;
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
use Visiosoft\CatsModule\Placeholderforsearch\PlaceholderforsearchSeeder;
class CatsModuleSeeder extends Seeder
{
@ -10,6 +9,5 @@ class CatsModuleSeeder extends Seeder
*/
public function run()
{
$this->call(PlaceholderforsearchSeeder::class);
}
}

View File

@ -1,10 +1,6 @@
<?php namespace Visiosoft\CatsModule;
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\CategoryRepository;
use Anomaly\Streams\Platform\Model\Cats\CatsCategoryEntryModel;
@ -51,9 +47,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
*/
protected $routes = [
'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/create' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@create',
'admin/cats/edit/{id}' => 'Visiosoft\CatsModule\Http\Controller\Admin\CategoryController@edit',
@ -117,7 +110,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
* @type array|null
*/
protected $bindings = [
CatsPlaceholderforsearchEntryModel::class => PlaceholderforsearchModel::class,
CatsCategoryEntryModel::class => CategoryModel::class,
];
@ -127,7 +119,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
* @type array|null
*/
protected $singletons = [
PlaceholderforsearchRepositoryInterface::class => PlaceholderforsearchRepository::class,
CategoryRepositoryInterface::class => CategoryRepository::class,
];
@ -203,11 +194,6 @@ class CatsModuleServiceProvider extends AddonServiceProvider
],
],
],
'placeholderforsearch' => [
'buttons' => [
'new_placeholderforsearch',
],
],
];
$this->addon->setSections($sections);
}

View File

@ -31,15 +31,8 @@ class CategoryController extends AdminController
public function index(CategoryTableBuilder $table, Request $request)
{
if ($this->request->action == "delete") {
$CategoriesModel = new CategoryModel();
foreach ($this->request->id as $item) {
$CategoriesModel->deleteSubCategories($item);
}
}
if (!isset($request->cat) || $request->cat == "") {
$categories = CategoryModel::query()->where('parent_category_id', '')->orWhereNull('parent_category_id')->get();
$categories = $categories->where('deleted_at', null);
if ($request->cat || $request->cat == "") {
$categories = $this->categoryRepository->getMainCategories();
} else {
$categories = CategoryModel::query()->where('parent_category_id', $request->cat)->whereNull('deleted_at')->get();
}

View File

@ -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);
}
}

View File

@ -7,77 +7,70 @@ use Visiosoft\LocationModule\City\Contract\CityRepositoryInterface;
class SitemapController extends PublicController
{
private $categoryRepository;
private $cityRepository;
private $category;
private $city;
public function __construct(
CategoryRepositoryInterface $categoryRepository,
CityRepositoryInterface $cityRepository
CategoryRepositoryInterface $category,
CityRepositoryInterface $city
)
{
parent::__construct();
$this->categoryRepository = $categoryRepository;
$this->cityRepository = $cityRepository;
$this->category = $category;
$this->city = $city;
}
public function index()
{
$categoriesCount = $this->categoryRepository->count();
$categoriesCount = $this->category->count();
$include_cities_sitemap = setting_value('visiosoft.module.cats::include_cities_sitemap');
$sitemap_dividing_number = setting_value('visiosoft.module.cats::sitemap_dividing_number');
if (setting_value('visiosoft.module.cats::include_cities_sitemap')) {
$citiesCount = $this->cityRepository->count();
if ($include_cities_sitemap) {
$citiesCount = $this->city->count();
$pagesCount = $citiesCount ? $categoriesCount * $citiesCount : $categoriesCount;
} else {
$pagesCount = $categoriesCount;
}
$pagesCount = ceil($pagesCount / setting_value('visiosoft.module.cats::sitemap_dividing_number'));
$pagesCount = ceil($pagesCount / $sitemap_dividing_number);
return response()->view('visiosoft.module.cats::sitemap.index', [
'pagesCount' => $pagesCount,
])->header('Content-Type', 'text/xml');
return $this->response->view('visiosoft.module.cats::sitemap.index', compact('pagesCount'))
->header('Content - Type', 'text / xml');
}
public function categories()
{
$sitemapDividingNumber = setting_value('visiosoft.module.cats::sitemap_dividing_number');
$page = request()->page ?: 1;
$skip = $page - 1;
$sitemapLinks = array();
$sitemap_dividing_number = setting_value('visiosoft.module.cats::sitemap_dividing_number');
$include_cities_sitemap = setting_value('visiosoft.module.cats::include_cities_sitemap');
if (setting_value('visiosoft.module.cats::include_cities_sitemap')
&& $citiesCount = $this->cityRepository->count()) {
$categoriesCount = $this->categoryRepository->count();
$takeCategories = $categoriesCount / ($categoriesCount * $citiesCount / $sitemapDividingNumber);
if ($citiesCount = $this->city->count() && $include_cities_sitemap) {
$categoriesCount = $this->category->count();
$categories = $this->categoryRepository
->newQuery()
->skip($takeCategories * $skip)
->take($takeCategories)
->get();
$take = $categoriesCount / ($categoriesCount * $citiesCount / $sitemap_dividing_number);
$categories = $this->category->skipAndTake($take, $skip);
$cities = $this->city->all();
$sitemapLinks = array();
$cities = $this->cityRepository->all();
foreach ($categories as $category) {
foreach ($cities as $city) {
$sitemapLinks[] = route('adv_list_seo', [$category->slug, $city->slug]);
}
}
} else {
$categories = $this->categoryRepository
->newQuery()
->skip($sitemapDividingNumber * $skip)
->take($sitemapDividingNumber)
->get();
$categories = $this->category->skipAndTake($sitemap_dividing_number, $skip);
$sitemapLinks = array();
foreach ($categories as $category) {
$sitemapLinks[] = route('adv_list_seo', [$category->slug]);
}
}
return response()->view('visiosoft.module.cats::sitemap.categories', [
'sitemapLinks' => $sitemapLinks,
])->header('Content-Type', 'text/xml');
return response()->view('visiosoft.module.cats::sitemap.categories', compact('sitemapLinks'))
->header('Content - Type', 'text / xml');
}
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Contract;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface PlaceholderforsearchInterface extends EntryInterface
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch\Contract;
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
interface PlaceholderforsearchRepositoryInterface extends EntryRepositoryInterface
{
}

View File

@ -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 = [];
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryCollection;
class PlaceholderforsearchCollection extends EntryCollection
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryCriteria;
class PlaceholderforsearchCriteria extends EntryCriteria
{
}

View File

@ -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
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryObserver;
class PlaceholderforsearchObserver extends EntryObserver
{
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
class PlaceholderforsearchPresenter extends EntryPresenter
{
}

View File

@ -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;
}
}

View File

@ -1,8 +0,0 @@
<?php namespace Visiosoft\CatsModule\Placeholderforsearch;
use Anomaly\Streams\Platform\Entry\EntryRouter;
class PlaceholderforsearchRouter extends EntryRouter
{
}

View File

@ -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'
]
]);
}
}

View File

@ -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 = [];
}