/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { if ($id == Folder::ROOT_FOLDER) { Flash::error(trans($this->resource_name . 'forbidden')); return redirect(route($this->show_route, [$id])); } try { $model = $this->getModel($id); $folders = Folder::ListItems([], $this->author_folder->id); $users = User::withTrashed()->lists('display_name', 'id'); $roots = [$this->author_folder->id => $this->author_folder->name]; return view($this->edit_view, compact(['model', 'folders', 'users', 'roots'])); } catch (Exception $e) { if ($e instanceof PDOException) { Flash::error($e->errorInfo[2]); } else { Flash::warning(trans($this->resource_name . 'not_found', ['model' => $this->model_name, 'id' => $id])); } return $this->index(); } }