PHP code example of ryangjchandler / laravel-comments

1. Go to this page and download the library: Download ryangjchandler/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/ */

    

ryangjchandler / laravel-comments example snippets


return [

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

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

];

use RyanChandler\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));

php artisan migrate
bash
php artisan vendor:publish --tag="comments-config"