public function get_all_childs($cat_id)
 {
     //        $user_info = Auth::user()->toArray();
     //        if ($user_info['user_type'] == 2) {
     if (count($cat_id) != "") {
         $cat = new Category();
         $all_childs = array();
         $child_category = array();
         $child_category_ids = array();
         $child_categories = $cat->get_categories_by_parent_id($cat_id);
         if ($child_categories != null) {
             foreach ($child_categories as $category_question) {
                 array_push($child_category, $category_question);
                 array_push($child_category_ids, $category_question['id']);
                 //                    array_push($child_category_content, $category_question['title']);
             }
             $sub_child_category = array();
             //                $sub_child_category_content = array();
             $sub_child_categories = $cat->get_categories_by_parents_id_in($child_category_ids);
             if ($sub_child_categories != null) {
                 foreach ($sub_child_categories as $category_question) {
                     array_push($sub_child_category, $category_question);
                     //                        array_push($sub_child_category_content, $category_question['title']);
                 }
             }
             $all_childs = array('child' => $child_category, 'sub_child' => $sub_child_category);
         }
         return $all_childs;
     }
     //        }
     //        $message = "you are not admin. you can't use this method";
     //        return view('welcome')
     //                        ->withMessage($message);
 }
 public function get_all_childs($cat_id)
 {
     if (!empty($cat_id)) {
         $cat = new Category();
         $all_childs = array();
         $child_category = array();
         $child_categories = $cat->get_categories_by_parent_id($cat_id);
         if ($child_categories != null) {
             foreach ($child_categories as $category_question) {
                 array_push($child_category, $category_question['id']);
             }
             $sub_child_category = array();
             $sub_child_categories = $cat->get_categories_by_parents_id_in($child_category);
             if ($sub_child_categories != null) {
                 foreach ($sub_child_categories as $category_question) {
                     array_push($sub_child_category, $category_question['id']);
                 }
             }
             $all_childs = array('child' => $child_category, 'sub_child' => $sub_child_category);
         }
         return $all_childs;
     }
 }