當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Category::get_categories_by_parent_id方法代碼示例

本文整理匯總了PHP中app\Category::get_categories_by_parent_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::get_categories_by_parent_id方法的具體用法?PHP Category::get_categories_by_parent_id怎麽用?PHP Category::get_categories_by_parent_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Category的用法示例。


在下文中一共展示了Category::get_categories_by_parent_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_all_childs

 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);
 }
開發者ID:Incubasys,項目名稱:sql_query_help,代碼行數:34,代碼來源:CategoryController.php

示例2: get_all_childs

 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;
     }
 }
開發者ID:Incubasys,項目名稱:sql_query_help,代碼行數:23,代碼來源:UserController.php


注:本文中的app\Category::get_categories_by_parent_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。