CategoryController.php 746 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace app\api\controller\store;
  3. use app\admin\model\store\StoreCate;
  4. use app\models\store\StoreCategory;
  5. use app\Request;
  6. class CategoryController
  7. {
  8. public function category(Request $request)
  9. {
  10. $cateogry = StoreCategory::with('children')->where('is_show', 1)->order('sort desc,id desc')->where('pid', 0)->select();
  11. return app('json')->success($cateogry->hidden(['add_time', 'is_show', 'sort', 'children.sort', 'children.add_time', 'children.pid', 'children.is_show'])->toArray());
  12. }
  13. public function store_cate(Request $request)
  14. {
  15. $cate = StoreCate::where('is_show', 1)->order('sort desc,id desc')->where('pid', 0)->select()->toArray();
  16. return app('json')->success($cate);
  17. }
  18. }