F
Filamentβ€’5mo ago
jjo63

Generic process for installing plugins?

Hi a little confused - I wanted to use this plugin https://github.com/solutionforest/Filament-SimpleLightBox I ran the composer command
composer require solution-forest/filament-simplelightbox
composer require solution-forest/filament-simplelightbox
No problems. I modified my file app/Providers/Filament/AdminPanelProvider.php to add the line referencing the plugin
class AdminPanelProvider extends PanelProvider
{

public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')

<snip of default code>

->plugin(SimpleLightBoxPlugin::make())
;
}
}
class AdminPanelProvider extends PanelProvider
{

public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')

<snip of default code>

->plugin(SimpleLightBoxPlugin::make())
;
}
}
When I tried to reload my app, I get an error Class "App\Providers\Filament\SimpleLightBoxPlugin" not found As there were no other installation / pre-req usage instructions I wondered whether this is me being ignorant of some typical steps you'd follow or if this is actually an issue with the installation of the plugin. Any pointers? thanks j
GitHub
GitHub - solutionforest/Filament-SimpleLightBox: Filament SimpleLig...
Filament SimpleLightbox is a PHP package that provides a simple and lightweight solution for implementing a lightbox feature in your Filament admin panel. It allows you to easily preview Image, PDF...
Solution:
You need to import the class otherwise PHP just assumes it's in the same namespace as the current file. You'll need to add the following to the above the panel provider class:
use SolutionForest\FilamentSimpleLightBox\SimpleLightBoxPlugin;
use SolutionForest\FilamentSimpleLightBox\SimpleLightBoxPlugin;
...
Jump to solution
3 Replies
Solution
ConnorHowell
ConnorHowellβ€’5mo ago
You need to import the class otherwise PHP just assumes it's in the same namespace as the current file. You'll need to add the following to the above the panel provider class:
use SolutionForest\FilamentSimpleLightBox\SimpleLightBoxPlugin;
use SolutionForest\FilamentSimpleLightBox\SimpleLightBoxPlugin;
jjo63
jjo63OPβ€’5mo ago
Perfect - so this is a general thing I guess - would you expect this to be in the README for a plugin? But thanks so much for the quick response - the app now loads agin πŸ™‚ cheers j
ConnorHowell
ConnorHowellβ€’5mo ago
Usually in snippets that use an imported class they'd stick the "use" line above the snippet but I think most assume that people are using IDEs that would automatically flag this and prompt the import
Want results from more Discord servers?
Add your server