本文整理汇总了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'));
}
示例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);
}
示例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);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
return backendView('index', array('users' => User::orderBy('id', 'DESC')->paginate(10)));
}
示例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]);
}
示例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]);
}
示例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);
}
示例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;
}