/** * Get all the posts for the homepage * @return \Theme */ public function getAll() { if (!\Cache::has('welcome')) { $posts = Posts::where('published_at', '!=', null)->orderBy('published_at', 'desc')->paginate(5); \Cache::put('welcome', $posts, 5); } else { $posts = \Cache::get('welcome'); } return \Theme::view('welcome', ['posts' => $posts]); }