PHP code example of lakm / laravel-comments-admin-panel

1. Go to this page and download the library: Download lakm/laravel-comments-admin-panel 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/ */

    

lakm / laravel-comments-admin-panel example snippets


//config/comments-admin-panel.php


use LakM\Comments\AdminPanel\Middleware\AdminPanelAccessMiddleware;

return [
        'enabled' => true,
        'routes' => [
            'middlewares' => [
                'web',
                AdminPanelAccessMiddleware::class, // Removing this, allow users to access admin panel if enabled is set to true !
            ],
            'prefix' => 'admin',
        ],
        /**
         * Commentable models(must implement CommentableContract) that the admin panel must track
         * Keep empty to use models auto-discovery
         */
        'commentable_models' => [],
];

'enabled' => false

//config/comments-admin-panel.php
  public function canAccessAdminPanel(): bool
  {
     return true;
  }


//config/comments-admin-panel.php
return [
    'commentable_models' => [Post::class], // Admin panel only track for post class
]

'routes' => ['prefix' => 'admin'],

 'routes' => [
            'middlewares' => [
                'web',
                AdminPanelAccessMiddleware::class, // Removing this, allow users to access admin panel if enabled is set to true !
            ],
        ],
bash
    php artisan commenter-admin-panel:install
bash
php artisan vendor:publish --tag=comments-admin-panel-config
bash
    php artisan vendor:publish --tag=comments-admin-panel-assets