PHP code example of opscale-co / nova-comments

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

    

opscale-co / nova-comments example snippets


use Opscale\NovaComments\Commentable;

class Post extends Model
{
    use Commentable;
}

use Opscale\NovaComments\Commenter;

public function fields(NovaRequest $request): array
{
    return [
        // ... your other fields ...
        Commenter::make(),
    ];
}

use Opscale\NovaComments\CommentsPanel;

public function fields(NovaRequest $request): array
{
    return [
        // ... fields ...
        new CommentsPanel(),
    ];
}

use Opscale\NovaComments\Models\Comment;

public function boot(): void
{
    Comment::whenCreating(function (Comment $comment): void {
        $comment->comment = MyPurifier::clean($comment->comment);
    });
}
bash
php artisan vendor:publish --tag=nova-comments-config