public function show($id) { $guide = Guide::findOrFail($id); $topNotes = Note::topNotes()->with('user')->take(6)->get(); $guide->load('comments.user'); $guide->incHits(); $faved = Auth::check() && GuideFav::exists(Auth::user()->id, $guide->id); $liked = Auth::check() && GuideLike::exists(Auth::user()->id, $guide->id); return view('guide.show', compact('guide', 'faved', 'liked', 'topNotes')); }
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() { $topNotes = Note::topNotes()->with('user')->take(4)->get(); return view('notes.index', compact('topNotes')); }