zhangchangchun 5 years ago
parent
commit
0db5aa5926
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/Repositories/CategoryRepository.php

+ 2 - 1
app/Repositories/CategoryRepository.php

@@ -47,6 +47,7 @@ class CategoryRepository {
             //'is_suggest' => $request['is_suggest'],
             'desc' => $request['desc'],
         ];
+        $topic_ids = '';
         if(!empty($request['topic_ids'])){
             $topic_ids = explode(',', $request['topic_ids']);
         }
@@ -54,7 +55,7 @@ class CategoryRepository {
         try{
             $categoryInfo = $this->category->create($data);
             if($categoryInfo){
-                if($topic_ids){
+                if(!empty($topic_ids)){
                     $category_topic_data = [];
                     foreach($topic_ids as $value){
                         $category_topic_data[] = [