/** * Handle an incoming request. * * @param $request * @param Closure $next * @param string $for * * @return \Illuminate\Http\RedirectResponse */ public function handle($request, Closure $next, $for = 'admin') { if (!$this->entry->getEntry($request->route()->getParameter('entry'))) { $route = $this->redirectToAdmin; if ($for !== 'admin') { $route = $this->redirectTo; } return redirect()->route($route); } return $next($request); }
/** * @param $id * @return \Illuminate\View\View */ public function edit($id) { $attributes = ['entry' => $this->entry->getEntry($id), 'id' => $id]; return view('admin.entry.edit', $attributes); }
/** * @param $id * * @return \Illuminate\View\View */ public function show($id) { $attributes = ['entry' => $this->entry->getEntry($id), 'comments' => $this->comment->getCommentsByEntry($id)]; return view('entry.show', $attributes); }