fix: viewPulse gate denies admins due to strict === on boolean is_admin

is_admin is cast to bool on the User model, so $user->is_admin === 1 is always
false and the gate 403s every user, admins included. Use a boolean check,
consistent with the viewHorizon gate.
pull/7432/head
Your Name 24 hours ago
parent 139b29733e
commit 5654ab6c27

@ -112,7 +112,9 @@ class AppServiceProvider extends ServiceProvider
Event::listen(Failed::class, LogFailedLogin::class);
Gate::define('viewPulse', function (User $user) {
return $user->is_admin === 1;
// is_admin is cast to bool on the User model, so a strict `=== 1`
// never matches. Use a boolean check, consistent with viewHorizon.
return (bool) $user->is_admin === true;
});
if (config('pulse.enabled', false)) {

Loading…
Cancel
Save