public static function getPath($id) { $path = []; $page = Pages::find($id); $page && ($page = $page) && array_push($path, $page); while ($page && $page->id != $page->page_id) { $page = Pages::find($page->page_id); $page && array_push($path, $page); } return $path; }
public function getEditor(Request $request) { $user = getUser(); $Input = new Input(); $Input->setId('admin.post.editor'); $Input->setFields(['alias' => '标识符', 'page_id' => '父页面', 'title' => '标题', 'content' => '正文', 'tag' => '标签', 'summary' => '摘要', 'keywords' => '关键字', 'description' => '描述']); $Input->init($request); $data['helpLink'] = true; $data['optionLink'] = true; $data['helpStatus'] = $Input->getHelpStatus(); $data['hiddenFields'] = $Input->getHiddenFields(); $data['options'] = $Input->options(); $data['tip'] = '编辑文章'; $data['pages'] = Pages::where('user_id', $user['id'])->orderBy('page_id', 'asc')->get(); $data['referer'] = setReferer('/admin/post/posts', '/admin/post/editor'); $data['active'] = 'editor'; $data = array_merge($data, $this->checkEdit($request)); if (!$request->ajax()) { return view('admin.post.editor', $data); } }