本文整理汇总了PHP中app\Page::take方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::take方法的具体用法?PHP Page::take怎么用?PHP Page::take使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::take方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @param \App\User $user
* @return Response
*/
public function index(User $user)
{
//$userId = \Auth::user()->id;
// get all pages
$pages = Page::take(500)->orderBy('created_at', 'desc')->get();
// index view
return view('superadmin.pages.index', compact('user'))->with('pages', $pages);
}
示例2: dashboard
/**
* Show the application dashboard screen to the superadmin.
*
* @return Response
*/
public function dashboard()
{
$activeCount = User::where('active', '1')->count();
$subscriberCount = User::where('role', 'subscriber')->count();
$freelancerCount = User::where('role', 'freelancer')->count();
$inactiveCount = User::where('active', '0')->count();
$latestUsers = User::take(4)->latest()->get();
$latestSubscribers = User::take(4)->where('role', 'subscriber')->latest()->get();
$latestPosts = Post::take(4)->latest()->get();
$latestPages = Page::take(4)->latest()->get();
return view('superadmin.dashboard')->with('activeCount', $activeCount)->with('subscriberCount', $subscriberCount)->with('freelancerCount', $freelancerCount)->with('inactiveCount', $inactiveCount)->with('latestUsers', $latestUsers)->with('latestSubscribers', $latestSubscribers)->with('latestPosts', $latestPosts)->with('latestPages', $latestPages);
}