PHP code example of naimul / db-visualizer

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

    

naimul / db-visualizer example snippets


Naimul\DbVisualizer\DbVisualizerServiceProvider::class,

use Illuminate\Support\Facades\Gate;

public function boot(): void
{
    // Allow authenticated admins only
    Gate::define('viewDbVisualizer', fn (?User $user) => $user?->is_admin);

    // Allow specific emails
    Gate::define('viewDbVisualizer', fn (?User $user) => in_array($user?->email, [
        '[email protected]',
    ]));

    // Allow everyone (including unauthenticated users)
    Gate::define('viewDbVisualizer', fn (?User $user) => true);
}
bash
php artisan vendor:publish --provider="Naimul\DbVisualizer\DbVisualizerServiceProvider" --tag="dbv-config"
bash
php artisan vendor:publish --provider="Naimul\DbVisualizer\DbVisualizerServiceProvider" --tag="dbv-resources"