本文整理汇总了PHP中app\Page::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::count方法的具体用法?PHP Page::count怎么用?PHP Page::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Page
的用法示例。
在下文中一共展示了Page::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a dashboard.
*
* @return Response
*/
public function index()
{
$userCount = User::count();
$pagesCount = Page::count();
$newsCount = News::count();
return view('util.index', compact('userCount', 'pagesCount', 'newsCount'));
}
示例2: index
/**
* Display the dashboard once the user is logged
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$nb_users = User::count();
$nb_posts = Post::count();
$nb_pages = Page::count();
return view('admin.admin', compact('nb_users', 'nb_posts', 'nb_pages'));
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), ['title' => 'required|min:5|max:60|unique:pages']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
$page = new Page();
if ($request->sort_id > 0) {
$page->sort_id = $request->sort_id;
} else {
$page->sort_id = $page->count() + 1;
}
$page->slug = !empty($request->slug) ? $request->slug : str_slug($request->title);
$page->title = $request->title;
$page->title_description = $request->title_description;
$page->meta_description = $request->meta_description;
$page->text = $request->text;
if ($request->status == 'on') {
$page->status = 1;
} else {
$page->status = 0;
}
$page->save();
return redirect('/admin/pages')->with('status', 'Страница добавлена!');
}
示例4: index
public function index()
{
$pages = \App\Page::count();
$banners = \App\Banner::count();
$coupons = \App\Coupons::count();
$posts = \App\Post::count();
$users = \App\User::count();
$images = \App\Image::count();
return view('home')->with('pages', $pages)->with('banners', $banners)->with('coupons', $coupons)->with('posts', $posts)->with('users', $users)->with('images', $images);
}