public function index() { $guidesGN = Guide::where('types', '=', 0)->where('istop', '=', 1)->orderBy('orders', 'asc')->take(5)->get(); $guidesGJ = Guide::where('types', '=', 1)->where('istop', '=', 1)->orderBy('orders', 'asc')->take(5)->get(); $guides = Guide::where('isbest', '=', 1)->orderBy('id', 'desc')->take(20)->get(); $comments = GuideComment::where('isbest', '=', 1)->orderBy('id', 'desc')->with('guide', 'user')->take(5)->get(); return view('guide.index', compact('guidesGN', 'guidesGJ', 'guides', 'comments')); }
public function index() { $activities = Activity::where('istop', 1)->where('states', 0)->orderBy('order_number')->get(); $guides = Guide::where('isbest', '=', 1)->orderBy('orders')->take(6)->get(); $topNotes = Note::topNotes()->with('user')->take(6)->get(); //$users = User::topUsers()->take(10)->get(); $adverts = Banner::where('tag', 'indexAdvert')->take(2)->get(); $banners = Banner::where('tag', 'indexBanner')->orderBy('orders')->get(); return view('index', compact('activities', 'guides', 'topNotes', 'adverts', 'banners')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $key = ''; $isbest = $request->input('isbest', 1); if ($request->has('key')) { $key = $request->input('key'); $query = Guide::where('title', 'like', '%' . $key . '%')->orWhere('area', 'like', '%' . $key . '%'); } else { $query = Guide::select(); } $query->where('isbest', $isbest); if ($isbest == 1) { $query->orderBy('orders', 'asc'); } else { $query->orderBy('id', 'desc'); } $guides = $query->paginate(20); return view('admin.guide.index', compact('key', 'guides', 'isbest')); }