Filament\PluginServiceProvider class provided by Filament:
Registering Plugins
Application Plugins
If youβre developing a plugin for a specific application, you should register the new service provider in yourconfig/app.php file:
Distributed Plugins
Much like a normal Laravel package, you should add your service providerβs fully qualified class name to theextra.laravel.providers array in your packageβs composer.json file:
Resources
To register a custom resource, add the fully qualified class name to theprotected $resources array in your service provider.
Resource and ensure that Livewire can discover it.
Pages
To register a custom page, add the fully qualified class name to theprotected $pages array in your service provider.
Page and ensure that Livewire can discover it.
Widgets
To register a custom widget, add the fully qualified class name to theprotected $widgets array in your service provider.
Widget and ensure that Livewire can discover it.
Roles
To register a custom role, add the fully qualified class name to theprotected $roles array in your service provider.
Role and ensure itβs available for use throughout your application.
Frontend Assets
Filament plugins can also register their own frontend assets. These assets will be included on all Filament related pages, allowing you to use your own CSS and JavaScript.Stylesheets
To include a custom stylesheet, add it to theprotected $styles property in your service provider. You should use a unique name as the key and the URL to the stylesheet as the value.
protected styles() method and return an array of key/value pairs, just like the $styles property:
Scripts
To include a custom script, add it to theprotected $scripts property in your service provider. You should use a unique name as the key and the URL to the script as the value.
protected scripts() method and return an array of key/value pairs, just like the $scripts property:
Providing Data to the Frontend
Whilst building your plugin, you might find the need to generate some data on the server and access it on the client. To do this, add a newprotected function scriptData() to your service provider and return an array of string keys and values that can be passed to converted into JSON.
Filament uses the @json Blade directive to convert your script data into a valid JavaScript object. You can find out more about this directive in the official Laravel documentation.