First, you need to buy a license here: https://spatie.be/index.php/docs/laravel-comments/v1/getting-a-license
Then follow the steps here: https://spatie.be/index.php/docs/laravel-comments/v1/installation-setup
You also have to install the livewire components library: https://spatie.be/index.php/docs/laravel-comments/v1/livewire-components/installation
Then in your AppServiceProvider's boot method, include these two:
Filament::registerRenderHook( 'head.end', fn (): string => Blade::render('<x-comments::styles />'),); Filament::registerRenderHook( 'body.end', fn (): string => Blade::render('<x-comments::scripts />'),);
Then create a Widget for the Resource where you want to use the comments, for example, DeliveryResource.
php artisan make:filament-widget Comments --resource=DeliveryResource
Then add public ?Model $record = null;
to the Widget Resource you created.
Edit the Widget's view file:
<x-filament::widget> <x-filament::card> <livewire:comments :model="$record" /> </x-filament::card></x-filament::widget>
Include the Widget in the Resource:
public static function getWidgets(): array{ return [ Comments::class, ];}
And also include in the EditPage:
protected function getFooterWidgets(): array{ return [ DeliveryResource\Widgets\Comments::class, ];}
You are done!
I have made my own thanks for the licesnce btw.