✈️Usage
Commentable Model
Model that the comment belongs to.
Commenter Model
Model that the user belongs to.
Implement CommentableContract and import Commentable trait in commentable model.
use LakM\Commenter\Concerns\Commentable;
use LakM\Commenter\Contracts\CommentableContract;
class Post extends Model implements CommentableContract
{
use Commentable;
}
Implement CommenterContract and import Commenter trait in commenter model.
use LakM\Commenter\Concerns\Commenter;
use LakM\Commenter\Contracts\CommenterContract;
class User extends Model implements CommenterContract
{
use Commenter;
}
Include styles in your layout.
<html>
<head>
@commenterStyles
</head>
</html>
Include scripts in your layout
<html>
<body>
@commenterScripts
</body>
</html>
Then simply include component in your blade file
<x-commenter::index :model="$post" />
You can omit the index part but make sure to include the double colon. Otherwise Laravel will search for the component in project instead of the package.
<x-commenter:: :model="$post" />
or you can use components separately,
<div x-cloak x-data class="space-y-8">
<livewire:comments.list-view :model="$model" />
<hr class="text-gray-400" />
<livewire:comments.create-form :model="$model" />
</div>
Last updated
Was this helpful?