當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::latest方法代碼示例

本文整理匯總了PHP中app\User::latest方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::latest方法的具體用法?PHP User::latest怎麽用?PHP User::latest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\User的用法示例。


在下文中一共展示了User::latest方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::latest()->paginate(2);
     $no = $users->firstItem();
     $subscription_data = Subscription::lists('subscription_name', 'id');
     return view('users.index', compact('users', 'no', 'subscription_data'));
 }
開發者ID:jasbirsingh-c,項目名稱:sharemarket_web360,代碼行數:12,代碼來源:UsersController.php

示例2: index

 public function index()
 {
     if ($this->checkRestriction()) {
         return Redirect::to('/');
     }
     $users = User::latest()->get();
     return view('user.index', compact('users'));
 }
開發者ID:biswaupreti,項目名稱:MobilityRequirements,代碼行數:8,代碼來源:UserController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $users = User::latest()->get();
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($users);
     }
     return view('users.index', compact('users'));
 }
開發者ID:vergidul,項目名稱:personal_project,代碼行數:13,代碼來源:UsersController.php

示例4: index

 /**
  * Show all users.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = User::latest('created_at')->get();
     if (Sentinel::hasAccess('admin')) {
         return view('admin.userlist', compact('users'));
     } else {
         return redirect('/');
     }
 }
開發者ID:ramigit3D,項目名稱:article,代碼行數:14,代碼來源:UsersController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $users = User::latest()->get();
     //Ci torna gli utenti in ordine cronologico secondo data di creazione
     /*		
     		if ($request->ajax() || $request->wantsJson()) {
         		return new JsonResponse($users);
         	}*/
     return view('users.index', compact('users'));
 }
開發者ID:khatiboss,項目名稱:laravel-users-example,代碼行數:15,代碼來源:UsersController.php

示例6: manage

 public function manage()
 {
     if (Auth::guest()) {
         return redirect('/');
     } elseif (Auth::user()->level < 2) {
         return redirect('/');
     }
     $users = User::latest()->get();
     return view('users/manage', compact('users'));
 }
開發者ID:museuvirtual,項目名稱:atlas,代碼行數:10,代碼來源:UsersController.php

示例7: adminIndex

 /**
  * Created By Dara on 6/11/2015
  * show list of credits for users in admin panel
  */
 public function adminIndex($user = null)
 {
     $users = [];
     if ($user != null) {
         $users[] = $user;
     } else {
         $users = User::latest()->with('roles')->paginate(20);
     }
     return view('admin.credit.index', compact('users'))->with(['title' => 'Balance management']);
 }
開發者ID:emadmrz,項目名稱:Hawk,代碼行數:14,代碼來源:CreditController.php

示例8: index

 public function index()
 {
     $latestArticles = Article::latest()->take(6)->get();
     $latestPosts = Post::latest()->take(6)->get();
     $latestProblems = Problem::latest()->take(6)->get();
     $latestGroups = Group::latest()->take(6)->get();
     $latestUsers = User::latest()->take(6)->get();
     $ratedUsers = User::orderBy('rate', 'desc')->take(6)->get();
     $chartDatas = Comment::select([DB::raw('DATE(created_at) AS date'), DB::raw('COUNT(id) AS count')])->groupBy('date')->orderBy('date', 'ASC')->get()->toArray();
     return view('admin.dashboard.index', compact('latestArticles', 'latestPosts', 'latestProblems', 'latestGroups', 'latestUsers', 'ratedUsers', 'chartDatas'))->with(['title' => 'Admin Dashboard Panel']);
 }
開發者ID:emadmrz,項目名稱:Hawk,代碼行數:11,代碼來源:DashboardController.php

示例9: users

 public function users(Request $request)
 {
     if (!$this->hasAccess($request)) {
         return Response()->json(['error' => 'Access denied.'], 500);
     }
     if (Gate::denies('admin')) {
         return Response()->json(['error' => 'Method not allowed'], 403);
     }
     // dd(User::latest()->with('publisher.territories')->get());
     return ['data' => $this->transformCollection(User::latest()->with('publisher.territories')->get(), 'user')];
 }
開發者ID:pierrestudios,項目名稱:territory-api,代碼行數:11,代碼來源:PublishersController.php

示例10: dashboardForAdmin

 protected function dashboardForAdmin()
 {
     $data['user'] = $this->user;
     $data['total_users'] = User::where('role', 'user')->count();
     $data['total_token'] = Token::count();
     $data['total_admins'] = User::where('role', 'admin')->count();
     $data['total_apps'] = Application::count();
     $data['most_used_app'] = Application::getMostUsedApps();
     $data['most_active_app'] = Application::getMostActiveApps();
     $data['users'] = User::latest()->take(10)->get();
     $data['applications'] = Application::latest()->take(10)->get();
     $data['opt_app'] = Application::getAppForSelect($this->user);
     return view('dashboard.admin', $data);
 }
開發者ID:GreenHackers,項目名稱:election-website,代碼行數:14,代碼來源:DashboardController.php

示例11: index

 public function index()
 {
     if (!\Auth::check()) {
         return redirect('home');
     }
     $userlist = User::latest('last_login_at')->where('email_verified', 1)->get();
     // Photos for Users
     $users = [];
     foreach ($userlist as $user) {
         $userlist_photo = $user->photos()->where('type', 'userlist')->orderBy('created_at', 'desc')->first() ?: [];
         // Need to fix this, because we are supposed to have picture when we register.
         // All users are supposed to have their pictures.
         if (empty($userlist_photo)) {
             $userlist_photo['path'] = '';
             $userlist_photo['type'] = '';
             $userlist_photo['name'] = '';
         }
         $userlist_photo['path'] = '/images/' . $user['id'] . '/' . $userlist_photo['type'] . '/' . $userlist_photo['name'];
         $users[] = array_add($user, 'userlist_photo', $userlist_photo);
     }
     return view('users.userlist', compact('users'));
 }
開發者ID:peco8,項目名稱:senseicloud-1.0,代碼行數:22,代碼來源:UserController.php

示例12: index

 public function index()
 {
     $users = User::latest('name')->get();
     return view('users.index')->with('users', $users);
 }
開發者ID:arnoldllanes,項目名稱:laracasts,代碼行數:5,代碼來源:UserController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = $this->user->latest()->get();
     return response($users);
 }
開發者ID:xzxzyzyz,項目名稱:laravel-websocket-sample,代碼行數:10,代碼來源:UserController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $users = User::latest('created_at')->paginate(10);
     return view('system.users.index', compact('users'));
 }
開發者ID:seahouse,項目名稱:hxerp,代碼行數:11,代碼來源:UsersController.php

示例15: getAddUser

 public function getAddUser()
 {
     $users = User::latest()->take(3)->get();
     $roles = Role::lists('name', 'id')->all();
     return view('users.add-user', compact('users', 'roles'));
 }
開發者ID:Armen2004,項目名稱:laravel-network,代碼行數:6,代碼來源:UMSController.php


注:本文中的app\User::latest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。