public static function getRandTip() { $tips = Cache::remember(self::CACHE_KEY, self::CACHE_MINUTES, function () { return Tip::all(); }); return $tips->random(); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $types = Type::all(); $types->toarray(); $tips = Tip::all(); $tips->toarray(); $breeds = Breed::all(); $breeds->toarray(); // $tips = DB::table('pet_tips') // ->where('breed_id', '=', $breed_id) // ->get(); return View::make('tips.tips', compact('types', 'breeds', 'tips')); }