From 05df1c6a5fbc6b506b6b49be899b00e41b27ec4f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 19 May 2018 20:58:45 -0600 Subject: [PATCH] Add admin middleware --- app/Http/Kernel.php | 1 + app/Http/Middleware/Admin.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 app/Http/Middleware/Admin.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 3439540c9..52a072844 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -51,6 +51,7 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ + 'admin' => \App\Http\Middleware\Admin::class, 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, diff --git a/app/Http/Middleware/Admin.php b/app/Http/Middleware/Admin.php new file mode 100644 index 000000000..e78290450 --- /dev/null +++ b/app/Http/Middleware/Admin.php @@ -0,0 +1,24 @@ +is_admin == false) { + return redirect(config('app.url')); + } + + return $next($request); + } +}