0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Filamentに Nested Comments プラグイン入れてみました。

Last updated at Posted at 2025-06-21

image.png
https://filamentphp.com/plugins/coolsam-nested-comments

1.composer 経由でパッケージをインストールします。

composer require coolsam/nested-comments

2.artisanコマンドでnested-commentインストールします。

php artisan nested-comments:install

3.blogモテルに commentを追加します。

use Coolsam\NestedComments\Concerns\HasReactions;ーー>ここ追加
class Blog extends Model
{
use HasComments;ーー>ここ追加

    protected $fillable = [
        'title',
        'status',
        'image',
        'detail',
    ];
}

4.blogのinfolistにコメントを追加します。

public static function infolist(Infolist $infolist): Infolist
    {
        return $infolist
        ->schema([
                Section::make()
                ->schema([
                TextEntry::make('name')
                    ->prose()
                    ->markdown()
                TextEntry::make('detail')
                    ->prose()
                    ->markdown()
                ]),
            \Coolsam\NestedComments\Filament\Infolists\CommentsEntry::make('comments'),ーー>ここ追加

    ]);
    }

追加

reactionを追加したりカスタマイズもできます。
nested-commentsインストールする際にconfigフォルダの中にnested-comments.php作成されるので、
そのファイルに様々なカスタマイズできます。
いいねボタンを追加してみます。

    'allowed-reactions' => [
        '👍' => 'thumbs up', // thumbs up
        '👎' => 'thumbs down', // thumbs down
        '❤️' => 'heart', // heart
        '😂' => 'laughing', // laughing
        '😮' => 'surprised', // surprised
        '😢' => 'crying', // crying
        '💯' => 'hundred points', // angry
        '🔥' => 'fire', // fire
        '🎉' => 'party popper', // party popper
        '🚀' => 'rocket', // rocket
        'いいね!' => 'iine', // iine いいね!テキストを追加
    ]

image.png
これから色々カスタマイズしてみたいと思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?