File tree Expand file tree Collapse file tree 13 files changed +132
-4
lines changed
Expand file tree Collapse file tree 13 files changed +132
-4
lines changed Original file line number Diff line number Diff line change 1+ @if (isset ($record ) )
2+ <livewire:nested-comments::comments :record =" $record" />
3+ @else
4+ <p >No Commentable record set.</p >
5+ @endif
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <x-dynamic-component :component =" $getEntryWrapperView()" :entry =" $entry" >
2+ <livewire:nested-comments::comments :record =" $getRecord()" />
3+ </x-dynamic-component >
Original file line number Diff line number Diff line change 1+ <x-filament-widgets::widget >
2+ @if ($this -> record )
3+ <livewire:nested-comments::comments :record =" $this->record" />
4+ @else
5+ <x-filament::section >
6+ No Commentable record found. Please pass a record to the widget.
7+ </x-filament::section >
8+ @endif
9+ </x-filament-widgets::widget >
Original file line number Diff line number Diff line change 1- <x-filament::section wire:poll.keep-alive class =" !ring-0" >
1+ <x-filament::section wire:poll.10s :compact = " true " class =" !ring-0 !shadow-none !p -0" >
22 <x-slot name =" heading" >
33 <div class =" flex items-center space-x-2" >
44 <div >
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ public function comments(): MorphMany
2121
2222 public function getCommentsCountAttribute (): int
2323 {
24- return $ this ->comments ()->count ();
24+ return $ this ->comments ()
25+ ->where ('parent_id ' , '= ' , null )
26+ ->count ();
2527 }
2628
2729 public function getCommentsTree ($ offset = null , $ limit = null , $ columns = ['* ' ]): Collection
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Coolsam \NestedComments \Filament \Actions ;
4+
5+ use Coolsam \NestedComments \NestedComments ;
6+ use Filament \Actions \Action ;
7+ use Illuminate \Contracts \Support \Htmlable ;
8+ use Illuminate \Contracts \View \View ;
9+
10+ class CommentsAction extends Action
11+ {
12+ protected function setUp (): void
13+ {
14+ parent ::setUp ();
15+ $ this ->modalWidth ('4xl ' )
16+ ->slideOver ()
17+ ->modalHeading (fn (): string => __ ('View Comments ' ));
18+ $ this ->modalSubmitAction (false );
19+ $ this ->modalCancelActionLabel (__ ('Close ' ));
20+ $ this ->icon ('heroicon-o-chat-bubble-left-right ' );
21+ $ this ->modalIcon ('heroicon-o-chat-bubble-left-right ' );
22+ }
23+
24+ public static function getDefaultName (): ?string
25+ {
26+ return 'comments ' ;
27+ }
28+
29+ public function getModalContent (): View | Htmlable | null
30+ {
31+ $ record = $ this ->getRecord ();
32+
33+ return app (NestedComments::class)->renderCommentsComponent ($ record );
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Coolsam \NestedComments \Filament \Infolists ;
4+
5+ use Closure ;
6+ use Filament \Infolists \Components \Entry ;
7+
8+ class CommentsEntry extends Entry
9+ {
10+ protected bool | Closure $ isLabelHidden = true ;
11+
12+ protected string $ view = 'nested-comments::filament.infolists.comments-entry ' ;
13+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Coolsam \NestedComments \Filament \Tables \Actions ;
4+
5+ use Coolsam \NestedComments \NestedComments ;
6+ use Filament \Tables \Actions \Action ;
7+ use Illuminate \Contracts \Support \Htmlable ;
8+ use Illuminate \Contracts \View \View ;
9+
10+ class CommentsAction extends Action
11+ {
12+ protected function setUp (): void
13+ {
14+ parent ::setUp ();
15+ $ this ->modalWidth ('4xl ' )
16+ ->slideOver ()
17+ ->modalHeading (fn (): string => __ ('Comments ' ));
18+ $ this ->modalSubmitAction (false );
19+ $ this ->modalCancelActionLabel (__ ('Close ' ));
20+ $ this ->icon ('heroicon-o-chat-bubble-left-right ' );
21+ $ this ->modalIcon ('heroicon-o-chat-bubble-left-right ' );
22+ }
23+
24+ public static function getDefaultName (): ?string
25+ {
26+ return 'comments ' ;
27+ }
28+
29+ public function getModalContent (): View | Htmlable | null
30+ {
31+ $ record = $ this ->getRecord ();
32+
33+ return app (NestedComments::class)->renderCommentsComponent ($ record );
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments