© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
3 replies
Hightower

User Relationship with Permissions

I want a relationship that links to the Users tables, but that only returns a set of users with a certain permission. This is what I've got so far:

    public function assignee(): BelongsTo
    {
        return $this->belongsTo(User::class)
            ->whereHas('permissions', function ($query) {
                $query->where('name', 'manage Tickets');
            });
    }
    public function assignee(): BelongsTo
    {
        return $this->belongsTo(User::class)
            ->whereHas('permissions', function ($query) {
                $query->where('name', 'manage Tickets');
            });
    }


It works to a point, but the dropdown I had on a form that worked perfectly before now shows the User ID rather than the Name. Can anyone advise please?
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

Relationship User & Role
FilamentFFilament / ❓┊help
3y ago
Apply permissions on Relationship Manager Actions
FilamentFFilament / ❓┊help
3y ago
Relationship problems? (relationship with where)
FilamentFFilament / ❓┊help
3y ago
editOptionForm with permissions
FilamentFFilament / ❓┊help
2y ago