That library include Comment
model and CommentBehaviour
.
It is simple and fast way to provide easy adding comments for others models.
The preferred way to install this extension is through composer.
Either run
composer require dmuratov/yii2-universal-comment:~1.0
or add
"dmuratov/yii2-universal-comment" : "~1.0"
to the require section of your application's composer.json
file.
Adding behaviour for model:
public function behaviors()
{
return [
...
'comment' => [
'class' => \dmuratov\comment\CommentBehaviour::className()
]
];
}
Adding comment for model
$model->addComment('Comment text');
Getting comments
$model->getComments()->all();