当前位置: 首页>>代码示例>>PHP>>正文


PHP User::orderBy方法代码示例

本文整理汇总了PHP中App\Model\User::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP User::orderBy方法的具体用法?PHP User::orderBy怎么用?PHP User::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Model\User的用法示例。


在下文中一共展示了User::orderBy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showVote

 /**
  * Show vote ladder
  * GET
  *
  * @return Response
  */
 public function showVote()
 {
     $users = Cache::remember('ladderVote', 60, function () {
         return UserManager::orderBy('votes', 'desc')->take(config('config.ladder_limit'))->get();
     });
     return view('ladder.vote', compact('users'));
 }
开发者ID:synthx,项目名称:infuse,代码行数:13,代码来源:LadderController.php

示例2: getSearch

 public function getSearch()
 {
     $builder = User::orderBy('updated_at');
     $pageSize = $this->request()->get('pageSize', 36);
     $sex = $this->request()->get('sex', UserEnum::SEX_FEMALE);
     $ageStart = $this->request()->get('age_start');
     $ageEnd = $this->request()->get('age_end');
     $wordkProvince = $this->request()->get('work_province');
     if ($sex) {
         $builder->where('sex', $sex);
     }
     if ($ageStart) {
         $birStart = ageToYear($ageStart);
         $builder->where('birthday', '<=', $birStart);
     }
     if ($ageEnd) {
         $birEnd = ageToYear($ageEnd);
         $builder->where('birthday', '>=', $birEnd);
     }
     if ($wordkProvince) {
         $builder->where('work_province', 'like', $wordkProvince);
     }
     $users = $builder->paginate($pageSize);
     $users->appends($this->request()->all());
     return $this->view('search')->with('users', $users);
 }
开发者ID:netxinyi,项目名称:meigui,代码行数:26,代码来源:IndexController.php

示例3: index

 public function index()
 {
     $where = $this->request()->all();
     $orderby = array_get($where, 'order', 'created_at');
     $sortby = array_get($where, 'sort', 'desc');
     \DB::enableQueryLog();
     $users = User::orderBy($orderby, $sortby);
     if (array_get($where, 'status')) {
         $users->status($where['status']);
     }
     if (array_get($where, 'level')) {
         $users->level($where['level']);
     }
     if (array_get($where, 'sex')) {
         $users->where('sex', $where['sex']);
     }
     if (array_get($where, 'age_start')) {
         $users->where('birthday', '<=', ageToYear($where['age_start']));
     }
     if (array_get($where, 'age_end')) {
         $users->where('birthday', '>=', ageToYear($where['age_end']));
     }
     if (array_get($where, 'keyword')) {
         $users->where(function ($query) use($where) {
             $keyword = '%' . $where['keyword'] . '%';
             $query->where('user_name', 'like', $keyword)->orWhere('mobile', 'like', $keyword)->orWhere('realname', 'like', $keyword)->orWhere('user_id', 'like', $keyword);
         });
     }
     $users = $users->with('likeMe')->paginate(array_get($where, 'size', 10));
     foreach ($where as $key => $query) {
         if ($key && $query) {
             $users->appends($key, $query);
         }
     }
     return $this->view('index')->with('users', $users);
 }
开发者ID:netxinyi,项目名称:meigui,代码行数:36,代码来源:UserController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     return backendView('index', array('users' => User::orderBy('id', 'DESC')->paginate(10)));
 }
开发者ID:jacke121,项目名称:tdbasset,代码行数:10,代码来源:UserController.php

示例5: users

 /**
  * Hiển thị danh sách các tài khoản
  *
  * @return Response
  */
 public function users()
 {
     /**
      * Kiểm tra TK đăng nhập nếu là Admin show ra tất cả các thành viên
      * Còn lại chỉ show TT TK đang đăng nhập
      */
     $page_title = 'Quản lý thành viên';
     if (Auth::user()->role == 1) {
         $users = User::orderBy('id')->paginate(5);
     } else {
         $users = User::where('id', Auth::user()->id)->paginate(5);
     }
     return view('auth.user.user_manager', ['users' => $users, 'page_title' => $page_title]);
 }
开发者ID:viethoang0703,项目名称:blogs,代码行数:19,代码来源:AdminController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = User::orderBy('corp')->get();
     return view('user.index', ['users' => $users]);
 }
开发者ID:jocoonopa,项目名称:lubri,代码行数:10,代码来源:UserController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $users = User::orderBy('name')->get();
     return view('user.list')->with('users', $users);
 }
开发者ID:joceline-putra,项目名称:ecommerce-laravel,代码行数:11,代码来源:UserController.php

示例8: index

 public function index(Request $request)
 {
     if ($request->input('username')) {
         return redirect('users/' . $request->input('username'));
     }
     $this->view->title = 'Users';
     $this->view->breadcrumbs = ['users' => 'Users'];
     $this->view->email_queue_count = \App\Model\QueuedEmail::count();
     $this->view->roles = Role::orderBy('name', 'ASC')->get();
     $this->view->users = User::orderBy('name', 'ASC')->paginate(20);
     $start = new \DateTime('today');
     $end = new \DateTime('1 month');
     $this->view->dates = new \DatePeriod($start, new \DateInterval('P1D'), $end);
     $this->view->day_count = iterator_count($this->view->dates);
     return $this->view;
 }
开发者ID:samwilson,项目名称:asset-manager,代码行数:16,代码来源:UsersController.php


注:本文中的App\Model\User::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。