Not be able to show a resource file with same model in different panels.

i have implement two panels in my code admin and onwer . In the admin panel i have implemented the user resource file with the user model. which is working fine. Now i implemented the same thing for my owner panel but it is not showing in the navigation bar. ``` <?php namespace App\Filament\Owner\Resources; use App\Filament\Owner\Resources\UserResource\Pages; use App\Filament\Owner\Resources\UserResource\RelationManagers; use App\Models\User; use Filament\Forms; use Filament\Forms\Form; use Filament\Resources\Resource; use Filament\Tables; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; class UserResource extends Resource { protected static ?string $model = User::class; protected static ?string $panel = 'owner'; protected static ?string $navigationIcon = 'heroicon-o-users'; protected static ?string $navigationGroup = 'Settings'; protected static ?string $navigationLabel = 'Users'; public static function getEloquentQuery(): Builder { return parent::getEloquentQuery(); } public static function shouldRegisterNavigation(): bool { return true; } public static function canViewNavigation(): bool { return true; } public static function table(Table $table): Table { return $table ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getPages(): array { return [ 'index' => Pages\ListUsers::route('/'), 'create' => Pages\CreateUser::route('/create'), 'edit' => Pages\EditUser::route('/{record}/edit'), ]; } } Note: i have removed the unnecessary code due to the text limit.
No description
11 Replies
awcodes
awcodes2w ago
Do you have more than one UserResource?
Ali Hassan
Ali HassanOP2w ago
yes @awcodes One in admin panel and one in owner panel i tried with a different name too. By giving a different name to the resource file. But the issue lies with this line of code. protected static ?string $model = User::class; If i use some other model name it shows up. But when i add this model . it don't show up.
awcodes
awcodes2w ago
Hmm, that’s shouldn’t matter. Are the resources any different between panels?
Ali Hassan
Ali HassanOP2w ago
mean?
awcodes
awcodes2w ago
Are the 2 UserResources doing anything different? Or are they the same.
Ali Hassan
Ali HassanOP2w ago
currently they doing the same thing. just fetching the data from the users table. issue is that for the owner panel the navigation tab isn't showing for admin side it is working fine
awcodes
awcodes2w ago
Either the auto discovery is off for the panel that isn’t working or there’s a policy issue. Hard to say without seeing all the code. If you have a repo you can share I’m happy to investigate it further though. But I’m not seeing anything wrong with the code you’ve shared.
Ali Hassan
Ali HassanOP2w ago
i can't share repo. But if there's any specific file you think there can be an issue i can share that file. Hope u understand.
Ali Hassan
Ali HassanOP2w ago
@awcodes this is my user model and owner panel provider files
awcodes
awcodes2w ago
Ok. Looks like your user depends on tenants but your owner panel doesn’t look like it’s using tenancy. Maybe that’s the issue. That’s the only thing standing out to me. But I’m not 💯 sure.
Ali Hassan
Ali HassanOP2w ago
@awcodes ok. thanks alot for taking your time to answer my query. i'll look into in.

Did you find this page helpful?