-
app/Providers/AuthServiceProvider.php
Open in GitHubuse App\Models\User; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { protected $policies = []; public function boot(): void { $this->registerPolicies(); Gate::before(static function (User $user): ?bool { return $user->is_superadmin ? true : null; }); Gate::define('viewFilament', static function (User $user): bool { return $user->is_superadmin; }); } }
-
resources/views/components/user-dropdown.blade.php
Open in GitHub// @canany(['viewFilament', 'viewHorizon']) <li class="py-1" role="none"> @can('viewFilament') <a href="{{ url()->filament('/') }}" class="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900" role="menuitem" >Backoffice</a> @endcan @can('viewHorizon') <a href="{{ url()->horizon('/') }}" class="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900" role="menuitem" >Queue</a> @endcan </li> @endcanany //