public function show($id) { $key = '_mp4_show_' . $id; if (Cache::has($key)) { $data = Cache::get($key); return View::make('mp4.show', $data); } $mp4 = MP4::with('user', 'category')->findOrFail($id); // $mp4->views += 1; // $mp4->save(); $related = MP4::related($mp4)->get(['id', 'name', 'image', 'download', 'views']); // return $related; $author = $mp4->user->username ? '@' . $mp4->user->username . ' —' : $mp4->user->name . ' — '; $data = ['mp4' => $mp4, 'title' => $mp4->name, 'related' => $related, 'author' => $author]; Cache::put($key, $data, 120); return View::make('mp4.show', $data); }