/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $post = $this->post->bySlug($request->segment(2)); if ($post->visibility_id == 2) { if (!$this->hash->check(Input::get('password'), $post->password)) { return redirect()->route('blog.askPassword', [$post->slug])->with('wrong_password', 'Please provide a valid password to view this post'); } } return $next($request); }
/** * @param $slug * @return \Illuminate\View\View */ public function show($slug) { $data = $this->getOverviewData(); $data['post'] = $this->post->bySlug($slug); return view('blogify.show', $data); }