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
Documentation: Added documentation for the Filament components (#23)
- Added documentation for Infolist Entry
- Added documentation for the Comments Widget
- Added documentation for the Comments Table Action
- Added documentation for teh Comments Header Action
This package allows you to incorporate comments and replies in your Filament forms, infolists, pages, widgets etc, or even simply in your livewire components. Comment replies can be nested as deep as you want, using the Nested Set data structure. Additionally, the package comes with a Reactions feature to enable your users to react to any of your models (e.g comments or posts) with selected emoji reactions.
Run the installation command and follow the prompts:
32
24
33
25
```bash
@@ -38,11 +30,186 @@ Adjust the configuration file as necessary, then run migrations.
38
30
39
31
`That's it! You are now ready to add nested comments
40
32
41
-
## Usage
42
-
**WIP**
33
+
## Usage: Comments
34
+
At the very basic level, this package is simply a Livewire Component that takes in a model record which is commentable. Follow the following steps to prepare your model to be commentable or reactable:
35
+
1. Add the `HasComments` trait to your model
43
36
```php
44
37
38
+
use Coolsam\NestedComments\Traits\HasComments;
39
+
40
+
class Conference extends Model
41
+
{
42
+
use HasComments;
43
+
44
+
// ...
45
+
}
46
+
47
+
```
48
+
2. If you would like to be able to react to your model directly as well, add the `HasReactions` trait to your model
49
+
```php
50
+
use Coolsam\NestedComments\Traits\HasReactions;
51
+
52
+
class Conference extends Model
53
+
{
54
+
use HasReactions;
55
+
56
+
// ...
57
+
}
45
58
```
59
+
3. You can now access the comments and reactions of your model in the following ways
60
+
61
+
### Using the Comments Infolist Entry
62
+
63
+
```php
64
+
public static function infolist(Infolist $infolist): Infolist
This unlocks incredible possibilities. It allows you to render your comments even in your own frontend blade page. All you have to do is simply pass the commentable `$record` to the blade component
200
+
```php
201
+
$record = Conference::find(1); // Get your record from the database then,
202
+
203
+
<x-nested-comments::comments:record="$record"/>
204
+
```
205
+
206
+
Alternatively, you could use the Livewire component if you prefer.
207
+
```php
208
+
$record = Conference::find(1); // Get your record from the database then,
0 commit comments