From 049e13e3658b02050fe761a7ca8af6789be6135f Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Jun 2016 02:48:52 -0700 Subject: [PATCH] Switch to gate for permission check --- app/Http/Middleware/CheckPermissions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Http/Middleware/CheckPermissions.php b/app/Http/Middleware/CheckPermissions.php index 6993ca144f..3d4b74fab9 100644 --- a/app/Http/Middleware/CheckPermissions.php +++ b/app/Http/Middleware/CheckPermissions.php @@ -5,6 +5,7 @@ namespace App\Http\Middleware; use Closure; use Config; use Route; +use Gate; class CheckPermissions { @@ -13,19 +14,22 @@ class CheckPermissions * * @param \Illuminate\Http\Request $request * @param \Closure $next - * @param string|null $guard + * @param string|null $section * @return mixed */ - public function handle($request, Closure $next, $section = null, $guard = null) + public function handle($request, Closure $next, $section = null) { - if (($request->user()->hasAccess($section)) || ($request->user()->isSuperUser())) { + if (Gate::allows($section)) { return $next($request); } return response()->view('layouts/basic', [ - 'content' => view('errors/403') + 'content' => view('errors/403') ]); + + + } }