PHP code example of admsys / laravel-comments

1. Go to this page and download the library: Download admsys/laravel-comments library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

admsys / laravel-comments example snippets


return [

    'model' => \Admsys\Comments\Models\Comment::class,
    'user' => \App\Models\User::class,

];

use Admsys\Comments\Concerns\HasComments;

class Post extends Model
{
    use HasComments;
}

$post = Post::first();

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

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

$post->comment('Thanks for commenting!', parent: Comment::find(2));
bash
php artisan vendor:publish --tag="comments-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="comments-config"