当前位置: 首页>>代码示例>>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;未经允许,请勿转载。