ainahid's avatar

Filament resource sub folder

How could i make a resource using artisan command as Filament Demo resources goes to Subfolder

  • Resources\
    • Blog\
      • Post
      • Authors
      • Comments

Blog have three resources in the Blog Folder

0 likes
2 replies
sllkevin's avatar

In v3, you can use clusters. You have to re-organize the folders a little but it should do what you're trying to do. In v4, I think there is now support for nested resources but I have not used it yet.

filamentphp . com/docs/3.x/panels/clusters

Eimmaarose's avatar

Hi ainahid,

You can create a Filament resource inside a subfolder by simply specifying the full path when running the Artisan command. For example, if you want to put your resource under a Blog folder:

php artisan make:filament-resource Blog/Post

This will create a PostResource inside:

app/Filament/Resources/Blog/PostResource.php

Filament automatically handles subfolders, so you can also create related resources like:

php artisan make:filament-resource Blog/Author php artisan make:filament-resource Blog/Comment

They’ll all be grouped neatly under app/Filament/Resources/Blog/.

If you want them to appear in a specific navigation group within the panel, you can also set the $navigationGroup property inside each resource, for example:

protected static ?string $navigationGroup = 'Blog';

That way, all your Blog resources will appear together in the sidebar.

Hope that helps!

— Eimmaa Rose

Please or to participate in this conversation.