|
@@ -20,6 +20,22 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
|
|
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
|
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Authorize Horizon with the admin guard.
|
|
|
|
|
+ *
|
|
|
|
|
+ * The default guard is customer, so the framework callback would inspect
|
|
|
|
|
+ * the storefront user. Dashboard access follows the admin session instead.
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function authorization(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->gate();
|
|
|
|
|
+
|
|
|
|
|
+ Horizon::auth(function ($request) {
|
|
|
|
|
+ return Gate::forUser($request->user('admin'))->check('viewHorizon')
|
|
|
|
|
+ || app()->environment('local');
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Register the Horizon gate.
|
|
* Register the Horizon gate.
|
|
|
*
|
|
*
|
|
@@ -29,8 +45,7 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
|
|
{
|
|
{
|
|
|
Gate::define('viewHorizon', function ($user = null) {
|
|
Gate::define('viewHorizon', function ($user = null) {
|
|
|
return in_array(optional($user)->email, [
|
|
return in_array(optional($user)->email, [
|
|
|
- "admin@longyi.com"
|
|
|
|
|
- //
|
|
|
|
|
|
|
+ 'admin@longyi.com',
|
|
|
]);
|
|
]);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|