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


PHP User::orderBy方法代码示例

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


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

示例1: lists

 /**
  * 获取账户列表.
  *
  * @param int $pageSize 分页大小
  *
  * @return \Illuminate\Pagination\Paginator
  */
 public function lists($filter, $sorter, $page, $pageSize)
 {
     //        $user = DB::table('users');
     //        /*
     //     * 构建过滤条件
     //     */
     //        if (is_array($filter) && count($filter) > 0) {
     //
     //            foreach ( $filter as $key => $value ) {
     //
     //                //用户名
     //                if (strcasecmp($key, 'username') == 0 ) {
     //                    $user->where('username', 'LIKE', "%{$value}%");
     //                }
     //
     //            }
     //        }
     //
     //        //构建排序条件
     //        if (is_array($sorter) && count($sorter) > 0) {
     //            foreach ($sorter as $key => $value) {
     //                //ID排序
     //                if (strcasecmp($key, 'ID') == 0) {
     //                    $sort = $value ? 'asc' : 'desc';
     //                    $user->orderBy('id', $sort);
     //                }
     //            }
     //        }
     return $this->model->orderBy('id', 'desc')->paginate($pageSize);
 }
开发者ID:zenoZz,项目名称:laravelapi,代码行数:37,代码来源:UserRepository.php

示例2: index

 public function index()
 {
     if (Auth::user()->admin) {
         $users = User::orderBy('name')->get();
         return view('admin.users', ['users' => $users]);
     }
 }
开发者ID:edilsonribeiro,项目名称:etec.palmital.quati,代码行数:7,代码来源:UserController.php

示例3: postIndex

 public function postIndex(Request $request)
 {
     // first retrieve the user list
     $users = \App\User::orderBy('last_name')->orderBy('first_name')->get();
     // now filter the collection as needed based on user input
     //first filter on name / email if user entered a string
     $umatch = strtolower($request->input('user'));
     if (isset($umatch) && $umatch != '') {
         $filtered = $users->filter(function ($item) use($umatch) {
             return is_int(strpos(strtolower($item->last_name), $umatch)) || is_int(strpos(strtolower($item->email), $umatch));
         });
         $users = $filtered;
     }
     // now filter by category
     $role = $request->input('role');
     if (isset($role) && $role != '') {
         $filtered = $users->filter(function ($item) use($role) {
             return $item->role == $role;
         });
         $users = $filtered;
     }
     // now return the view with the filtered list
     $request->session()->put('users', $users);
     $ucol = $request->session()->get('ucol');
     return view('users', ['sortOrder' => $ucol], ['users' => $users]);
 }
开发者ID:bsmitty54,项目名称:P4,代码行数:26,代码来源:UserController.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $web = Web::find($id);
     $users = User::orderBy('nombre')->lists('nombre', 'id');
     $categorias = Category::orderBy('nombre')->lists('nombre', 'id');
     return view('admin.web.edit', compact('web', 'users', 'categorias'));
 }
开发者ID:JohanArmando,项目名称:MaxCorpMedia,代码行数:13,代码来源:WebController.php

示例5: index

 public function index()
 {
     $user = \Auth::user();
     $time = $this->formatDate();
     $action = 'home';
     $r = Signin::where('user_id', \Auth::user()->id)->first();
     $count = 0;
     $signined = false;
     if ($r) {
         $count = $r['count'];
         if (substr(Carbon::now(), 0, 10) == substr($r['last_signin'], 0, 10)) {
             $signined = true;
         }
     }
     $signinList = Signin::where('last_signin', 'like', substr(Carbon::now(), 0, 10) . '%')->orderBy('last_signin', 'desc')->get();
     foreach ($signinList as &$item) {
         $item['last_signin'] = substr($item['last_signin'], 11, 8);
     }
     $cates = Cate::orderBy('count', 'desc')->limit(6)->get();
     $authors = User::orderBy('score', 'desc')->limit(6)->get();
     $teams = Team::limit(3)->get();
     $recommendedArticles = Article::orderBy('recommend', 'deac')->limit(4)->get();
     $phpArticles = Article::where('cate_id', 1)->limit(5)->get();
     $todayHotArticles = Article::where('published_at', '>=', Carbon::now()->subDay(1))->where('published_at', '<=', Carbon::now())->orderBy('view', 'deac')->limit(6)->get();
     $weekHotArticles = Article::where('published_at', '>=', Carbon::now()->subDay(7))->where('published_at', '<=', Carbon::now())->orderBy('view', 'deac')->limit(6)->get();
     return view('home', compact('user', 'time', 'action', 'signin', 'minus', 'count', 'signined', 'signinList', 'cates', 'authors', 'teams', 'recommendedArticles', 'phpArticles', 'todayHotArticles', 'weekHotArticles'));
 }
开发者ID:Panfen,项目名称:mango,代码行数:27,代码来源:HomeController.php

示例6: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $new_id = User::all()->count() > 0 ? User::orderBy('id', 'desc')->first()->id + 1 : 2400;
     DB::connection('member')->table('tb_user')->insert(['mid' => $data['name'], 'password' => $data['password'], 'pwd' => Hash::make($data['password']), 'idnum' => $new_id]);
     DB::connection('account')->table('accounts')->insert(['id' => $new_id, 'username' => $data['name'], 'password' => $data['password']]);
     return User::create(['id' => $new_id, 'username' => $data['name'], 'password' => Hash::make($data['password']), 'role' => 'member']);
 }
开发者ID:huludini,项目名称:aura-kingdom-web,代码行数:13,代码来源:AuthController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (!\Auth::getUser()->is_admin) {
         return redirect(route('profile'));
     }
     return view('user/index')->with(['list' => \App\User::orderBy('is_active', 'ASC')->orderBy('is_admin', 'DESC')->orderBy('name', 'ASC')->paginate(20), 'page_title' => 'Пользователи']);
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:12,代码来源:UserController.php

示例8: getTeam

 public function getTeam(Request $request)
 {
     if ($request->ajax() || $request->wantsJson) {
         return User::orderBy('lastname')->orderBy('firstname')->get(['firstname', 'lastname', 'email', 'id']);
     }
     abort(404);
 }
开发者ID:patrikkernke,项目名称:basecamp,代码行数:7,代码来源:TeamController.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $title = "Staff";
     $data = User::orderBy('id', 'desc')->get();
     return view('html.staff.list', compact('data', 'title'));
 }
开发者ID:trongtri0705,项目名称:staff,代码行数:12,代码来源:StaffController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = User::orderBy('id', 'ASC')->paginate(10);
     return view('admin.users.index')->with('users', $users);
     /*$users = User::orderBy('id', 'ASC')->paginate(5);
       return view('admin.users.index')->with('users', $users);*/
 }
开发者ID:Helg18,项目名称:mailer_laravel,代码行数:12,代码来源:UsersController.php

示例11: edit

 /**
  * Show the form for creating a new Cruiseline.
  *
  * @return View
  */
 public function edit($id)
 {
     $article = Article::find($id);
     $tags = Tag::lists('name', 'id');
     $users = User::orderBy('name', 'ASC')->lists('name', 'id');
     return view('articles.edit', compact('article', 'tags', 'users'));
 }
开发者ID:bigDeacs,项目名称:bunbury,代码行数:12,代码来源:ArticlesController.php

示例12: users

 public function users()
 {
     $users = User::orderBy('level_id', 'asc')->get();
     $level = Level::lists('name', 'id');
     $ppk = Ppk::lists('name', 'id');
     return View('admin.preset.users', compact('users', 'level', 'ppk'));
 }
开发者ID:suhairi,项目名称:keuntungan,代码行数:7,代码来源:PresetController.php

示例13: destroy

 public function destroy($id)
 {
     $user = User::find($id);
     $user->delete();
     Flash::warning('El usuario ' . $user->name . ' ha sido eliminado de forma exitosa');
     $users = User::orderBy('id', 'ASC')->paginate(10);
     return view('admin.users.index')->with('users', $users);
 }
开发者ID:Rodieche,项目名称:catalogo_web,代码行数:8,代码来源:UsersController.php

示例14: htmlSelectAll

 public static function htmlSelectAll()
 {
     $res = [];
     foreach (User::orderBy('name')->get() as $u) {
         $res[$u->id] = $u->name . ' (' . $u->email . ')';
     }
     return $res;
 }
开发者ID:jonasdahl,项目名称:mammeriet,代码行数:8,代码来源:User.php

示例15: index

 public function index()
 {
     if (!\Auth::user()->admin()) {
         return redirect()->route('agenda.index');
     }
     $users = User::orderBy('type', 'DESC')->orderBy('name', 'ASC')->get();
     return view('admin.users.index')->with('users', $users);
 }
开发者ID:rikardote,项目名称:agenda,代码行数:8,代码来源:RegistroController.php


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