From: Vincent Vanwaelscappel Date: Thu, 5 Mar 2020 17:17:26 +0000 (+0100) Subject: done #3466 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0ebab60a4cf0464f46226d118538c892955bf785;p=cubist_cms-back.git done #3466 --- diff --git a/src/app/helpers.php b/src/app/helpers.php index 40ed2a1..e46f520 100644 --- a/src/app/helpers.php +++ b/src/app/helpers.php @@ -36,6 +36,13 @@ if (!function_exists('protected_path')) { if (!function_exists('can')) { function can($permission, $model = null) { - return auth()->user()->can($permission, $model = null); + $auth = auth(); + if ($auth) { + $user = $auth->user(); + if ($user) { + return $user->can($permission, $model); + } + } + return false; } }