Setting up your models
Implement the required contracts and traits on your models.
To enable commenting functionality, you need to update your models as follows:
1. Implement the Commenter contract
In your User model, implement the Commenter contract and use the isCommenter trait:
PHP
use Tilto\Commentable\Contracts\Commenter;
use Tilto\Commentable\Traits\IsCommenter;
class User extends Model implements Commenter
{
use isCommenter;
}2. Implement the Commentable contract
In the model you want to make commentable (for example, Post), implement the Commentable contract and use the HasComments trait:
PHP
use Tilto\Commentable\Traits\HasComments;
use Tilto\Commentable\Contracts\Commentable;
class Post extends Model implements Commentable
{
use HasComments;
}
