From 7fd5388929e63fe7114604a21e386e0387172b6c Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 9 Dec 2024 00:21:02 +0330 Subject: [PATCH] fixed bug parent --- app/Http/Controllers/Admin/CategoryController.php | 4 +++- app/Http/Controllers/Admin/GroupController.php | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/CategoryController.php b/app/Http/Controllers/Admin/CategoryController.php index d68be70..c29f655 100644 --- a/app/Http/Controllers/Admin/CategoryController.php +++ b/app/Http/Controllers/Admin/CategoryController.php @@ -58,7 +58,9 @@ class CategoryController extends XController $category->subtitle = $request->input('subtitle'); $category->icon = $request->input('icon'); $category->description = $request->input('description'); - if ($category->parent_id == ''){ + if ($request->input('parent_id') == ''){ + $category->parent_id = null; + }else{ $category->parent_id = $request->input('parent_id',null); } if ($request->has('canonical') && trim($request->input('canonical')) != ''){ diff --git a/app/Http/Controllers/Admin/GroupController.php b/app/Http/Controllers/Admin/GroupController.php index 51a4ee1..5619cf0 100644 --- a/app/Http/Controllers/Admin/GroupController.php +++ b/app/Http/Controllers/Admin/GroupController.php @@ -56,9 +56,13 @@ class GroupController extends XController $group->name = $request->input('name'); $group->subtitle = $request->input('subtitle'); $group->description = $request->input('description'); - if ($group->parent_id == ''){ + + if ($request->input('parent_id') == ''){ + $group->parent_id = null; + }else{ $group->parent_id = $request->input('parent_id',null); } + if ($request->has('canonical') && trim($request->input('canonical')) != ''){ $group->canonical = $request->input('canonical'); }