CategoryController.php 488 B

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