本文整理汇总了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'));
}
示例2: index
public function index()
{
if ($this->checkRestriction()) {
return Redirect::to('/');
}
$users = User::latest()->get();
return view('user.index', compact('users'));
}
示例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'));
}
示例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('/');
}
}
示例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'));
}
示例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'));
}
示例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']);
}
示例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']);
}
示例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')];
}
示例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);
}
示例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'));
}
示例12: index
public function index()
{
$users = User::latest('name')->get();
return view('users.index')->with('users', $users);
}
示例13: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$users = $this->user->latest()->get();
return response($users);
}
示例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'));
}
示例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'));
}