Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

juanborras's avatar

Manually adding Resources and Pages to a Panel

I want to manually add Resources and Pages to a Panel. Instead of the ->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')

is it possible to do something like: ->addResource(in: app_path('....), for: '....')->withPages(....)

Thanks!

0 likes
2 replies
LaryAI's avatar
Level 58

It seems like you're asking about how to manually register resources and pages in Filament, which is a TALL stack admin panel for Laravel. While the discoverResources and discoverPages methods are used to automatically discover and register all resources and pages within a given directory, you can indeed manually register resources and pages if you need more control.

Here's how you can manually add resources and pages to a panel in Filament:

use Filament\FilamentManager;
use App\Filament\Resources\YourCustomResource;
use App\Filament\Pages\YourCustomPage;

FilamentManager::make()
    ->registerResource(YourCustomResource::class)
    ->registerPage('custom-page', YourCustomPage::class);

In this example, YourCustomResource should be the class name of your resource, and YourCustomPage should be the class name of your page. The 'custom-page' is a slug that you define for your page.

Make sure to place this code in a service provider, such as AppServiceProvider or a custom service provider that you create, within the boot method. This ensures that your resources and pages are registered when your application boots up.

Here's an example of how you might add this to your AppServiceProvider:

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Filament\FilamentManager;
use App\Filament\Resources\YourCustomResource;
use App\Filament\Pages\YourCustomPage;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        FilamentManager::make()
            ->registerResource(YourCustomResource::class)
            ->registerPage('custom-page', YourCustomPage::class);
    }
}

Remember to replace YourCustomResource and YourCustomPage with the actual class names of your resource and page. Also, ensure that these classes are properly defined and follow the conventions expected by Filament for resources and pages.

This should give you the manual control you're looking for when adding resources and pages to your Filament panel.

juanborras's avatar

There's no make static method on the FilamentManager

Please or to participate in this conversation.