From 1505c84df90da6c2038b392a53649ca9081dda91 Mon Sep 17 00:00:00 2001 From: Kenneth Keegan Date: Wed, 5 Sep 2018 15:12:02 -0700 Subject: [PATCH] Filter list of available authorized dashboards This commit filters the dashboard list so that the navigation will not show Dashboards the user is not authorized to see (via the authorize() method on the dashboards. This allows for different sets of dashboard depending on authorization policies. --- src/DashboardNova.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/DashboardNova.php b/src/DashboardNova.php index 4338b4d..a020ebb 100644 --- a/src/DashboardNova.php +++ b/src/DashboardNova.php @@ -40,7 +40,10 @@ public static function copyDefaultDashboardCards() */ public static function availableDashboards(Request $request) { - return collect(static::$dashboards)->all(); + return collect(static::$dashboards) + ->filter + ->authorize($request) + ->all(); } /**