F
Filament2y ago
Gush

RelationManager Group Owner edit only his group

Hey, i want to do a relationManager Resource but only the edit group of user part, how can i achieve this
4 Replies
Gush
GushOP2y ago
this is the RelationManager i did for admins to edit all groups, but in this case i also have a is_owner that should only be able to edit the group he is owner of
Dan Harrin
Dan Harrin2y ago
if its permission-related you probably want a laravel policy?
Gush
GushOP2y ago
public function boot(): void
{
Filament::navigation(function (NavigationBuilder $builder): NavigationBuilder {

if (auth()->user()->is_owner){
$itemsOwner [] = NavigationItem::make('Group Manager')
->icon('heroicon-o-home')
->activeIcon('heroicon-s-home')
->isActiveWhen(fn (): bool => request()->routeIs('filament.resources.groups.edit'))
->url(route('filament.resources.groups.edit', ['record'=>auth()->user()->group->id]));
}
}}
public function boot(): void
{
Filament::navigation(function (NavigationBuilder $builder): NavigationBuilder {

if (auth()->user()->is_owner){
$itemsOwner [] = NavigationItem::make('Group Manager')
->icon('heroicon-o-home')
->activeIcon('heroicon-s-home')
->isActiveWhen(fn (): bool => request()->routeIs('filament.resources.groups.edit'))
->url(route('filament.resources.groups.edit', ['record'=>auth()->user()->group->id]));
}
}}
got the job done here is how i made it if anyone faces the same situation
Want results from more Discord servers?
Add your server