© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
TranceCode

Use Policies only for companies Panel, not other

Friends, I have a problem, I am working on a tenancy app with integration of roles and permissions, for the companies panel everything works ok, the problem is that when entering the administration panel the app blocks and does not allow me to view the information, this happens because I am using within the administration panel, the same Model as in Companies, I am referring to the User model, I was looking for an exclusive policy that could be used for said panels, and in chatgpt it suggests this example, but it still doesn't work for me. works.


This is my Policies for Companies Panel

<?php

namespace App\Policies;

use App\Models\User;

class UserPolicy
{
    /**
     * Determine whether the user can view any models.
     */
    public function viewAny(User $user): bool
    {
        return $user->hasRole('Administrador');
    }

}
<?php

namespace App\Policies;

use App\Models\User;

class UserPolicy
{
    /**
     * Determine whether the user can view any models.
     */
    public function viewAny(User $user): bool
    {
        return $user->hasRole('Administrador');
    }

}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Model Policies for only 1 panel?
FilamentFFilament / ❓┊help
3y ago
Policies for ManageRelatedRecords only
FilamentFFilament / ❓┊help
16mo ago
Use metronic or any other admin panel with filament ?
FilamentFFilament / ❓┊help
3y ago
2nd panel with other authmiddleware
FilamentFFilament / ❓┊help
2y ago