]> _ Git - cubist_cms-back.git/commitdiff
done #3466
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Mar 2020 17:17:26 +0000 (18:17 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Mar 2020 17:17:26 +0000 (18:17 +0100)
src/app/helpers.php

index 40ed2a169bbf2a8715abfae803e086339e470c37..e46f520265bdb2069e69f738410887c716f73e63 100644 (file)
@@ -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;
     }
 }