return parent category list for create sub category

This commit is contained in:
vedatakd 2019-10-21 10:30:11 +03:00
parent 9977c01f49
commit ade7012515

View File

@ -39,6 +39,7 @@ class CategoryController extends AdminController
if ($this->request->action == "save") { if ($this->request->action == "save") {
$all = $this->request->all(); $all = $this->request->all();
$id = $all['parent_category']; $id = $all['parent_category'];
$parent_id = $all['parent_category'];
$k = 1; $k = 1;
for ($i = 0; $i < $k; $i++) { for ($i = 0; $i < $k; $i++) {
$cat1 = CategoryModel::query()->where('cats_category.id', $id)->first(); $cat1 = CategoryModel::query()->where('cats_category.id', $id)->first();
@ -57,6 +58,11 @@ class CategoryController extends AdminController
if ($form->hasFormErrors()) { if ($form->hasFormErrors()) {
return $this->redirect->to('/admin/cats/create'); return $this->redirect->to('/admin/cats/create');
} }
if($parent_id != "")
{
return $this->redirect->to('/admin/cats?cat='.$parent_id);
}
return $this->redirect->to('/admin/cats'); return $this->redirect->to('/admin/cats');
} else { } else {
$form->setFields(['name']); $form->setFields(['name']);