FilamentF
Filament3y ago
flex

Register Resources from a Plugin without adding it as Plugin in Panel?

Hi, in v2 I used PluginServiceProvider::$resources to register new resources. So, I just needed to install the package and the resource was available.

While upgrading to v3 I'm extending PackageServiceProvider now, but the resources don't get registered:

Is there any option to register resources in v3 from a plugin without the need to register it in the "parent" panel (as this is in a package for me too)?

Thank you!

<?php
namespace X\Blog\Providers;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use X\Blog\Filament\Resources\PostResource;

class FilamentServiceProvider extends PackageServiceProvider
{
    public static string $name = 'X/blog';

    protected array $resources = [
        PostResource::class,
    ];
 
    public function configurePackage(Package $package): void
    {
        $package->name('X/blog');
    }
}
Was this page helpful?