mirror of
https://github.com/wearepixel/laravel-comments.git
synced 2026-11-14 22:12:35 +00:00
Added example for nesting comments to Readme
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
# Add comments to your Laravel application
|
||||
|
||||
[](https://packagist.org/packages/beyondcode/laravel-comments)
|
||||
[](https://travis-ci.org/beyondcode/laravel-comments)
|
||||
[](https://scrutinizer-ci.com/g/beyondcode/laravel-comments)
|
||||
[](https://packagist.org/packages/beyondcode/laravel-comments)
|
||||
|
||||
Add the ability to associate comments to your Laravel Eloquent models. The comments can be approved and nested.
|
||||
@@ -139,6 +137,16 @@ $approved = $post->comments()->approved()->get();
|
||||
|
||||
```
|
||||
|
||||
### Nesting Comments
|
||||
|
||||
`BeyondCode\Comments\Comment` itself implements the `HasComments` trait, so you can comment on a comment and therefore nest them:
|
||||
|
||||
```php
|
||||
$comment = BeyondCode\Comments\Comment::first();
|
||||
$comment->commentAsUser($user, "Hey there!");
|
||||
```
|
||||
|
||||
|
||||
### Testing
|
||||
|
||||
``` bash
|
||||
|
||||
Reference in New Issue
Block a user