mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -06:00
completed clean sub categories
This commit is contained in:
parent
ee69934c3d
commit
cd9a416ff1
@ -117,7 +117,7 @@ class CategoryRepository extends EntryRepository implements CategoryRepositoryIn
|
|||||||
|
|
||||||
public function getDeletedCategories()
|
public function getDeletedCategories()
|
||||||
{
|
{
|
||||||
return $this->newQuery()->whereNotNull('deleted_at')->get();
|
return $this->model->withTrashed()->newQuery()->whereNotNull('deleted_at')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMainAndSubCats()
|
public function getMainAndSubCats()
|
||||||
|
|||||||
@ -213,21 +213,17 @@ class CategoryController extends AdminController
|
|||||||
|
|
||||||
public function cleanSubCategories()
|
public function cleanSubCategories()
|
||||||
{
|
{
|
||||||
// $cats = $this->categoryRepository->getDeletedCategories();
|
$sub_c = 1;
|
||||||
//
|
for ($i = 0; $i <= $sub_c; $i++) {
|
||||||
// $delete_category_keys = $cats->pluck('id');
|
$cats = $this->categoryRepository->getDeletedCategories();
|
||||||
//
|
$delete_category_keys = $cats->pluck('id')->all();
|
||||||
// dd($delete_category_keys);
|
$query_delete = $this->categoryRepository->newQuery()->whereIn('parent_category_id', $delete_category_keys);
|
||||||
//
|
if ($query_delete->count()) {
|
||||||
// foreach ($cats as $cat) {
|
$query_delete->delete();
|
||||||
// $parentCatId = $cat->parent_category_id;
|
$sub_c++;
|
||||||
// $parentCat = $this->categoryRepository->find($parentCatId);
|
}
|
||||||
// if (is_null($parentCat) && !is_null($parentCatId)) {
|
}
|
||||||
// $this->categoryEntryTranslationsModel->where('entry_id', $cat->id)->delete();
|
|
||||||
// //Todo Sub Categories
|
|
||||||
// $deletedCatsCount++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return redirect('admin/cats');
|
return redirect('admin/cats');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user