F
Filament2mo ago
TK

Setting navigation group as collapsed by default

How do I set a navigation group, which is created from the resource AND used by multiple resources, to be collapsed by default?
class RelationFilamentResource extends Resource
{
...

public static function getNavigationLabel(): string
{
return 'Relations';
}

public static function getNavigationGroup(): ?string
{
return 'Reservations'; // <--- same navigation group that should be collapsed by default!
}

...
class RelationFilamentResource extends Resource
{
...

public static function getNavigationLabel(): string
{
return 'Relations';
}

public static function getNavigationGroup(): ?string
{
return 'Reservations'; // <--- same navigation group that should be collapsed by default!
}

...
class PaymentFilamentResource extends Resource
{
...

public static function getNavigationLabel(): string
{
return 'Payments';
}

public static function getNavigationGroup(): ?string
{
return 'Reservations'; // <--- same navigation group that should be collapsed by default!
}

...
class PaymentFilamentResource extends Resource
{
...

public static function getNavigationLabel(): string
{
return 'Payments';
}

public static function getNavigationGroup(): ?string
{
return 'Reservations'; // <--- same navigation group that should be collapsed by default!
}

...
3 Replies
Expecto Patronum
you can set navigation group in your panel provider and set the group every each resources that you wish. you can refer to this documentation. and add ->collapsed()
No description
TK
TK2mo ago
@Expecto Patronum I've tried that, but nothing changed. Just to make sure I understand, I DEFINE the navigation groups inside the panel provider, and remove the navigation group definitions in the resources. I only tell the resources under which navigation group they should belong? For some reason, I can't get this to work. What change do I need to make in the resources? Also, whatever group I make via the portal provider, they aren't showing up. Got it working.. Appearently it only works, if you actually apply a resource to that menu "name" ty!
Expecto Patronum
Yes Glad to hear it
Want results from more Discord servers?
Add your server
More Posts