Registering asset in plugin

I am building a plugin which adds all agenda related views. I need some javascript for the headers to work and I am registering it in my plugin provider.
public function packageBooted(): void
{
FilamentAsset::register([
Js::make('deet', __DIR__ . '/../resources/dist/syncscroll.js'),
], package: 'uxit/deet');
}
public function packageBooted(): void
{
FilamentAsset::register([
Js::make('deet', __DIR__ . '/../resources/dist/syncscroll.js'),
], package: 'uxit/deet');
}
However it says that the resource is not found in the network tab in the browser. It is showing up in the tree of html elements but I am doing something wrong with specifying the path to the resource. Help would really be appreciated!
No description
No description
No description
3 Replies
awcodes
awcodes5mo ago
php artisan filament:assets The script has to be published by filament. This normally runs when installing the plugin or composer update.
gladjanus43
gladjanus43OP5mo ago
thank you very much! I have now also found an alternative solution by checking out some other plugins. They have a scripts view in their view resources and then do @include(static::$scriptsView) which also loads the script. What is the better method of loading the script? It does now correctly work if I dont specify the loadOnRequest() However when I add this it errors out on maximum tries
Want results from more Discord servers?
Add your server