© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
2 replies
ddoddsr

Add laravel-comments to a RelationManager.

I followed the talk that Dan Harrin and Freek had about two years ago about Spaties laravel-comments in Filament v2. Also saw the v2 trick for this.
I made changes to the examples to make it work on FilamentV3 and I made some real progress, showing thc comments connected to a
Resource
Resource
with a widget. There is also a CommentsResource which I have add will upon request.
However, now I need the Comments on a
RelationManager
RelationManager
and don't see how to get the Widget working on a RelationManager.
Given the simplicity of the Widget what can I do with a page or livewire component?

This is a paid plugin so no channel?
install laravel-client and the livewire plugin
In App\Providers\AppServiceProvider. boot method
Filament::registerRenderHook(
    PanelsRenderHook::STYLES_AFTER,
    fn (): string => Blade::render('@laravelCommentsLivewireStyles'),
);

Filament::registerRenderHook(
    PanelsRenderHook::SCRIPTS_AFTER,
    fn (): string => Blade::render('@laravelCommentsLivewireScripts'),
);
Filament::registerRenderHook(
    PanelsRenderHook::STYLES_AFTER,
    fn (): string => Blade::render('@laravelCommentsLivewireStyles'),
);

Filament::registerRenderHook(
    PanelsRenderHook::SCRIPTS_AFTER,
    fn (): string => Blade::render('@laravelCommentsLivewireScripts'),
);

Then in the model
use Spatie\Comments\Models\Concerns\HasComments;


use HasComments;
...
public function commentableName(): string
{
    return $this->first_name .' ' .$this->last_name  ;
}
public function commentUrl(): string
{
    return '';
}
use Spatie\Comments\Models\Concerns\HasComments;


use HasComments;
...
public function commentableName(): string
{
    return $this->first_name .' ' .$this->last_name  ;
}
public function commentUrl(): string
{
    return '';
}

Widget
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;
use Illuminate\Database\Eloquent\Model;

class Comments extends Widget
{
    protected static string $view = 'filament.widgets.comments';

    public Model $record;

    public function getColumnSpan(): int | string | array
    {
        return $this->columnSpan;
    }


}
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;
use Illuminate\Database\Eloquent\Model;

class Comments extends Widget
{
    protected static string $view = 'filament.widgets.comments';

    public Model $record;

    public function getColumnSpan(): int | string | array
    {
        return $this->columnSpan;
    }


}

widgit view
<x-filament-widgets::widget>
    @if($record)
        <x-filament::section>
            <livewire:comments :model="$record" />
        </x-filament::section>
    @endif
</x-filament-widgets::widget>
<x-filament-widgets::widget>
    @if($record)
        <x-filament::section>
            <livewire:comments :model="$record" />
        </x-filament::section>
    @endif
</x-filament-widgets::widget>

All of the above works in a resource when I add the widget to
getWidgets()
getWidgets()


This does not work in the RelationManager
getFooterWidgets()
getFooterWidgets()

Or
getWidgets()
getWidgets()
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Laravel Comments in Filament v3
FilamentFFilament / ❓┊help
3y ago
How Add a widget to relationManager form
FilamentFFilament / ❓┊help
14mo ago
Add new record with RelationManager from a ViewResource
FilamentFFilament / ❓┊help
2y ago
How to add LocaleSwitcher in RelationManager modal window?
FilamentFFilament / ❓┊help
3y ago