You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+125-9Lines changed: 125 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,22 @@
1
-
# Add comments to your Filament Resources.
1
+
# Filament Comments
2
2
3
3
[](https://packagist.org/packages/parallax/filament-comments)
use Parallax\FilamentComments\Actions\CommentsAction;
77
+
78
+
class ViewProduct extends ViewRecord
79
+
{
80
+
protected function getHeaderActions(): array
81
+
{
82
+
return [
83
+
CommentsAction::make(),
84
+
];
85
+
}
86
+
}
87
+
```
88
+
89
+
You may customise the page action as you would any other action.
90
+
91
+
#### 2. Table actions
40
92
41
-
TODO
93
+
Open the resource where you want the comments table action to appear.
94
+
95
+
Add the `CommentsAction` to the `$table->actions()` method.
96
+
97
+
```php
98
+
<?php
99
+
100
+
namespace App\Filament\Resources;
101
+
102
+
use Parallax\FilamentComments\Tables\Actions\CommentsAction;
103
+
104
+
class ProductResource extends Resource
105
+
{
106
+
public static function table(Table $table): Table
107
+
{
108
+
return $table
109
+
->actions([
110
+
CommentsAction::make(),
111
+
]);
112
+
}
113
+
}
114
+
```
115
+
116
+
You may customise the table action as you would any other action.
117
+
118
+
#### 3. Infolist entry
119
+
120
+
It's also possible to use the comments component within your infolist.
121
+
122
+
Add the `CommentsEntry` to the `$infolist->schema()` method.
123
+
124
+
```php
125
+
<?php
126
+
127
+
namespace App\Filament\Resources;
128
+
129
+
use Parallax\FilamentComments\Infolists\Components\CommentsEntry;
130
+
131
+
class ProductResource extends Resource
132
+
{
133
+
public static function infolist(Infolist $infolist): Infolist
134
+
{
135
+
return $infolist
136
+
->schema([
137
+
CommentsEntry::make('filament_comments'),
138
+
]);
139
+
}
140
+
}
141
+
```
142
+
143
+
Please note that this cannot be used in combination with a comments action on the same page.
144
+
145
+
## Authorisation
146
+
147
+
By default, all users can view & create comments as well as only delete their own comments.
148
+
149
+
If you would like to change this behaviour you can create your own eloquent model policy for the `Parallax\FilamentComments\Models\FilamentComment` model.
150
+
151
+
You should define the policy class in the `filament-comments` config file.
0 commit comments