Giter Site home page Giter Site logo

commentator's Introduction

Commentator ๐Ÿคญ

You're supposed to be using a third-party comment system not this.

But if you really need to, this package lets you add a comment section to your pages.

Install

$ composer require plmrlnsnts/commentator

Prerequisites

Run the following command to publish files we will need later on.

php artisan vendor:publish --provider="Plmrlnsnts\Commentator\CommentatorServiceProvider"

You can change the User namespace in config/commentator.php.

return [
    'models' => [
        'user' => \App\Models\User::class
    ]
];

Run the migrations.

php artisan migrate

Models

Users may start adding comments once the HasComments trait has been added to an eloquent model.

class Article extends Model
{
    use \Plmrlnsnts\Commentator\HasComments;
}

Livewire

This package has few Livewire components that can display a comment section in any of your blade templates. Here is a template to get you started.

<html>
<head>
    ...
    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
    @livewireStyles
</head>

<body>
    <main>
        ...
        @livewire('commentator::comments', ['commentable' => $article])
    </main>

    ...
    @livewireScripts
    <script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine-ie11.js" defer></script>
</body>
</html>

Customizations

Unsatistfied with the default appearance? Modify the component views in resources/views/vendor/commentator directory to match your preference.

API Controllers

There is also an artisan command to scaffold the comment controller and routes for you.

php artisan commentator:make

commentator's People

Contributors

plmrlnsnts avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.