/** * Display the specified resource. * * @param int $id * @return Response */ public function show($slug) { Session::put('key', ""); $post = array(); if (is_numeric($slug)) { $post = $this->getpostbyID($slug); } else { $post = $this->getpostbySlug($slug); } if (empty($post)) { return view('errors.404'); //return redirect('notfound'); } $arr = array('data' => $post, 'author' => $this->getpostAuthor($post->idpengguna)); if (Auth::check()) { $arr += array('update' => $this->is_update(), 'nama' => $this->getname(), 'nickname' => $this->getnick()); } $log = \App\Logdata::where(array('pathinfo' => '/' . $post->slug, 'ip' => $_SERVER['REMOTE_ADDR']))->get(); if (sizeof($log) < 2) { $lihat = Posts::where('slug', $post->slug)->first(); $lihat->lihat = (int) $lihat->lihat + 1; $lihat->save(); } return view('post.detail')->with($arr); }