Commenter
GitHubAdmin Panel
v2
v2
  • 😍Commenter
  • Overview
    • 💡Why Commenter
    • 🗞️Articles
    • ✨Key Features
    • 🤖Technologies
  • Basics
    • 🧠Concept
    • ®️Requirements
    • 🔨Installation
    • ✈️Usage
    • 🌈Themes
  • Demo
    • 👩‍🏫Project
    • 📺Basic Demo Video
    • 📼Full Demo Video
  • Configuration
    • 📜Publish Config
    • Migrations/Tables
    • ⚖️Change Mode
    • 🔐Authorization
    • ⏲️Limit comments per user
    • 😍Reactions
    • ⛔Approval
    • 🚧Validations
    • Sorting
    • 🛠️Other Options
  • Advance
    • 🔏Security
    • 🚀Performance
    • ⚡Events
    • 🌍Localization
    • 🛟Customization
    • 🕵️Testing
  • 🛣️Roadmap
  • 💓Sponsor
Powered by GitBook
On this page
  • Commentable Model
  • Commenter Model
  • Implement CommentableContract and import Commentable trait in commentable model.
  • Implement CommenterContract and import Commenter trait in commenter model.
  • Include styles in your layout.
  • Include scripts in your layout
  • Then simply include component in your blade file

Was this helpful?

Edit on GitHub
  1. Basics

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\Comments\Concerns\Commentable;
use LakM\Comments\Contracts\CommentableContract;

class Post extends Model implements CommentableContract
{
    use Commentable;
}

Implement CommenterContract and import Commenter trait in commenter model.

use LakM\Comments\Concerns\Commenter;
use LakM\Comments\Contracts\CommenterContract;

class User extends Model implements CommenterContract
{
    use Commenter;
}

Include styles in your layout.

<html>
    <head>
        @commentsStyles
    </head>
</html>

To avoid CSS name conflicts, we recommend adding your styles to the end of the head tag.

Include scripts in your layout

<html>
    <body>
        @commentsScripts
    </body>
</html>

To improve performance we recommend adding script at the end of the body tag.

Then simply include component in your blade file

<x-comments::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-comments:: :model="$post" />

or you can use components separately,

<div x-cloak x-data class="space-y-8">
    <livewire:comments-list :model="$model" />
    <hr class="text-gray-400" />
    <livewire:comments-create-form :model="$model" />
</div>
PreviousInstallationNextThemes

Last updated 7 months ago

Was this helpful?

✈️