Relation does not show on edit page #2122
rubabnaziri
started this conversation in
General
Replies: 1 comment 3 replies
-
If you have a PermissionPolicy, make sure that the user can |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a simple application with Users, Roles, Permissions, Groups (Teams in filament)
Users have Roles,
Roles have Permissions,
Groups have Roles and Users.
On my User Edit page I can see Group and Role table.
However On my Roles Edit page I do not see the Permissions table, i.e. I can't see what permissions are attached to a role.
Can someone help with this?
RoleResource
`<?php
namespace App\Filament\Resources;
use App\Filament\Resources\RoleResource\Pages;
use App\Filament\Resources\RoleResource\RelationManagers;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables\Columns\TextColumn;
use Spatie\Permission\Models\Role as ModelsRole;
class RoleResource extends Resource
{
protected static ?string $model = ModelsRole::class;
}
`
PermissionsRelationManager
`<?php
namespace App\Filament\Resources\RoleResource\RelationManagers;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\RelationManagers\BelongsToManyRelationManager;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Model;
class PermissionsRelationManager extends BelongsToManyRelationManager
{
protected static string $relationship = 'permissions';
}
`
Beta Was this translation helpful? Give feedback.
All reactions