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); }
public function getList(Request $request, $type = 'all') { $perpage = 20; $banners = Banner::orderBy('banner_sort', 'ASC'); $allCount = Banner::count(); $onlineCount = Banner::where('banner_active', '=', '1')->count(); $offlineCount = Banner::where('banner_active', '=', '0')->count(); if ($type == 'online') { $banners = $banners->where('banner_active', '=', '1'); } elseif ($type == 'offline') { $banners = $banners->where('banner_active', '=', '0'); } $banners = $banners->paginate($perpage); session(['previousUrl' => URL::full()]); return view('manage.banner.list', ['TITLE' => '轮播列表', 'META_KEYWORDS' => META_KEYWORDS, 'META_DESC' => META_DESC, 'PAGE_CODE' => '/manage/banner/list', 'type' => $type, 'banners' => $banners, 'allCount' => $allCount, 'onlineCount' => $onlineCount, 'offlineCount' => $offlineCount]); }