From 6597cbcacaa2acc06dddfa8bba0153e89e8205d3 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Sun, 9 Jul 2023 15:44:30 +0800 Subject: [PATCH] =?UTF-8?q?AddFeature:=20=E5=A4=84=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=BF=94=E5=9B=9E=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 viewPageNotFounded 方法 添加 viewNoPermission 方法 添加 构造 方法 中登录用户判断管理员方案 Signed-off-by: XiaoLFeng --- app/Http/Controllers/Index.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Index.php b/app/Http/Controllers/Index.php index 8141898..23bf6c1 100644 --- a/app/Http/Controllers/Index.php +++ b/app/Http/Controllers/Index.php @@ -41,10 +41,11 @@ public function __construct() $this->data = array_merge($this->data, ['GonganCode' => $data[0]]); } if (Auth::check()) { - $this->data = array_merge($this->data,[ + $this->data = array_merge($this->data, [ 'userName' => Auth::user()->username, 'userEmail' => Auth::user()->email, - 'userIcon' => Auth::user()->icon]); + 'userIcon' => Auth::user()->icon, + 'userAdmin' => Auth::user()->admin]); } } @@ -63,6 +64,18 @@ protected function ViewAboutMe(): Factory|View|Application return view('about', $this->data); } + protected function viewPageNotFounded(): Factory|View|Application + { + $this->data['webSubTitle'] = '页面未找到'; + return view('modules.404', $this->data); + } + + protected function viewNoPermission(): Factory|View|Application + { + $this->data['webSubTitle'] = '没有权限'; + return view('modules.no-permission', $this->data); + } + private function MarkdownToStringReplace(string $dataBase): string { $decodeText = MarkdownExtra::defaultTransform($dataBase);