A dead-simple comments package for Laravel.

Overview

A dead-simple comments package for Laravel.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides an incredibly simple comment system for your Laravel applications.

If you're looking for a package with UI components, I highly recommend using Spatie's laravel-comments package which comes with Livewire support out of the box.

Installation

You can install the package via Composer:

composer require ryangjchandler/laravel-comments

The package automatically registers migrations so there's no need to publish anything, just run them.

php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="laravel-comments-config"

This is the contents of the published config file:

return [

    'model' => \RyanChandler\Comments\Models\Comment::class,

    'user' => \App\Models\User::class,

];

Usage

Start by using the RyanChandler\Comments\Concerns\HasComments trait on your model.

use RyanChandler\Comments\Concerns\HasComments;

class Post extends Model
{
    use HasComments;
}

This trait adds a comments(): MorphMany relationship on your model. It also adds a new comment() method that can be used to quickly add a comment to your model.

$post = Post::first();

$post->comment('Hello, world!');

By default, the package will use the authenticated user's ID as the "commentor". You can customise this by providing a custom User to the comment() method.

$post->comment('Hello, world!', user: User::first());

The package also supports parent -> children relationships for comments. This means that a comment can belongTo another comment.

$post->comment('Thanks for commenting!', parent: Comment::find(2));

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

You might also like...
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.

Webdevetc BlogEtc - Complete Laravel Blog Package Quickly add a blog with admin panel to your existing Laravel project. It has everything included (ro

This package provides extended support for our spatie/enum package in Laravel.
This package provides extended support for our spatie/enum package in Laravel.

Laravel support for spatie/enum This package provides extended support for our spatie/enum package in Laravel. Installation You can install the packag

Testbench Component is the de-facto package that has been designed to help you write tests for your Laravel package

Laravel Testing Helper for Packages Development Testbench Component is the de-facto package that has been designed to help you write tests for your La

🥳🔐 This package is a Laravel package that checks if an email address is a spammer
🥳🔐 This package is a Laravel package that checks if an email address is a spammer

This package is a Laravel package that checks if an email address is a spammer. It verifies your signups and form submissions to confirm that they are legitimate.

Simple user messaging package for Laravel

Laravel Messenger This package will allow you to add a full user messaging system into your Laravel application. Leave some feedback How are you using

A Simple GUID creator Laravel Package for PHP

A Simple GUID creator package for PHP. This package is useful for creating globally unique identifiers (GUID). It's under MIT license so it's free for

A package to easily make use of Simple Icons in your Laravel Blade views.
A package to easily make use of Simple Icons in your Laravel Blade views.

Blade Simple Icons A package to easily make use of Simple Icons in your Laravel Blade views. For a full list of available icons see the SVG directory.

Laravel SEO - This is a simple and extensible package for improving SEO via meta tags, such as OpenGraph tags.

This is a simple and extensible package for improving SEO via meta tags, such as OpenGraph tags.

A simple API documentation package for Laravel using OpenAPI and Stoplight Elements

Laravel Stoplight Elements Easily publish your API documentation using your OpenAPI document in your Laravel Application. Installation You can install

Comments
Releases(v0.1.0)
Owner
Ryan Chandler
Ryan Chandler
Laravel comments - This package enables to easily associate comments to any Eloquent model in your Laravel application

Laravel comments - This package enables to easily associate comments to any Eloquent model in your Laravel application

Rubik 4 May 12, 2022
Dead simple Laravel backend support for FilePond js.

Laravel FilePond Backend This package provides a straight forward backend support for Laravel application to work with FilePond file upload javascript

rahulhaque 64 Jan 3, 2023
A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.

Laravel Moderation A simple Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc. Keep yo

Alex Kyriakidis 509 Dec 30, 2022
Native comments for your Laravel application.

Comments Comments is a Laravel package. With it you can easily implement native comments for your application. Overview This package can be used to co

Laravelista 626 Dec 30, 2022
An index of Laravel's cascading comments

Cascading Comments An index of Laravel's cascading comments. Visit the site at cascading-comments.sjorso.com. About This is a cascading comment: casca

Sjors Ottjes 4 Apr 28, 2022
Simplifies writing DocBlock comments in Javascript, PHP, CoffeeScript, Actionscript, C & C++

DocBlockr DocBlockr is a package for Sublime Text 2 & 3 which makes writing documentation a breeze. DocBlockr supports JavaScript (including ES6), PHP

Nick Fisher 3.1k Nov 25, 2022
Madison is a platform for lawmakers to share legislation with their citizens, allowing the community to add comments and suggest improvements.

Madison Madison is an open-source document engagement and feedback platform. While Madison can be used to collaborate on many different kinds of docum

OpenGov Foundation 591 Dec 17, 2022
Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

null 686 Dec 28, 2022
A Laravel chat package. You can use this package to create a chat/messaging Laravel application.

Chat Create a Chat application for your multiple Models Table of Contents Click to expand Introduction Installation Usage Adding the ability to partic

Tinashe Musonza 931 Dec 24, 2022
A Laravel package that adds a simple image functionality to any Laravel model

Laraimage A Laravel package that adds a simple image functionality to any Laravel model Introduction Laraimage served four use cases when using images

Hussein Feras 52 Jul 17, 2022