how to add pages and live wire in custom plugin
i am using this github repo-https://github.com/filamentphp/plugin-skeleton
and when i add pages inside sourcer it give error
Class "chats\chats\chats" not found
at vendor/filament/filament/src/PluginServiceProvider.php:81
77▕
78▕ public function packageBooted(): void
79▕ {
80▕ foreach ($this->getPages() as $page) {
➜ 81▕ Livewire::component($page::getName(), $page);
82▕ }
83▕
84▕ foreach ($this->getRelationManagers() as $manager) {
85▕ if ($manager instanceof RelationGroup) {
+8 vendor frames
9 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation{closure}()
+5 vendor frames
15 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
and where can i place livewire
of that page
GitHub
GitHub - filamentphp/plugin-skeleton: A package skeleton for develo...
A package skeleton for developing Filament plugins. - GitHub - filamentphp/plugin-skeleton: A package skeleton for developing Filament plugins.
2 Replies
Livewire can’t autodiscover components in your package. So you need to manually register them in your plug-in’s service provider.
<?php
namespace Chats\Chats;
use Filament\PluginServiceProvider;
use chats\chats\pages\Chats;
use Spatie\LaravelPackageTools\Package;
class chatsServiceProvider extends PluginServiceProvider
{
public static string $name = 'chats';
protected array $resources = [
// CustomResource::class,
];
protected array $pages = [
Chats::class,
];
protected array $widgets = [
// CustomWidget::class,
];
protected array $styles = [
'plugin-chats' => DIR.'/../resources/dist/chats.css',
];
protected array $scripts = [
'plugin-chats' => DIR.'/../resources/dist/chats.js',
];
// protected array $beforeCoreScripts = [
// 'plugin-chats' => DIR . '/../resources/dist/chats.js',
// ];
public function configurePackage(Package $package): void
{
$package->name(static::$name);
}
}
but chat page is not found