From 0ebab60a4cf0464f46226d118538c892955bf785 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 5 Mar 2020 18:17:26 +0100 Subject: [PATCH] done #3466 --- src/app/helpers.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; } } -- 2.39.5