PHP code example of mahmoudabdelhalim / db-manager

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

    

mahmoudabdelhalim / db-manager example snippets


return [

    /*
    |--------------------------------------------------------------------------
    | Enable / Disable
    |--------------------------------------------------------------------------
    | Quickly turn the entire UI on or off without touching routes.
    | When disabled, all DB Manager routes return a 404.
    */
    'enabled' => env('DB_MANAGER_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | URL Prefix
    |--------------------------------------------------------------------------
    | The URI prefix for all DB Manager routes.
    | Default: yourapp.com/db-manager
    */
    'prefix' => env('DB_MANAGER_PREFIX', 'db-manager'),

    /*
    |--------------------------------------------------------------------------
    | Middleware
    |--------------------------------------------------------------------------
    | Middleware applied to all DB Manager routes.
    | Add any gate, role, or custom middleware here.
    */
    'middleware' => ['web', 'auth'],

    /*
    |--------------------------------------------------------------------------
    | Connection Mode
    |--------------------------------------------------------------------------
    | Controls how DB Manager connects to MySQL.
    |
    | 'laravel'  — auto-connects using Laravel's default DB config,
    |              shows only the application's own database.
    |
    | 'all'      — same credentials as 'laravel' but shows every
    |              database on the MySQL server.
    |
    | 'custom'   — presents a login form; credentials are stored
    |              in the session for the duration of the visit.
    */
    'connection_mode' => env('DB_MANAGER_CONNECTION_MODE', 'laravel'),

    /*
    |--------------------------------------------------------------------------
    | Laravel Connection Name
    |--------------------------------------------------------------------------
    | Which connection from config/database.php to use in 'laravel'
    | and 'all' modes. Leave null to use the default connection.
    */
    'connection' => env('DB_MANAGER_CONNECTION', null),

];

'connection_mode' => 'laravel',
'connection'      => null, // uses DB_CONNECTION from .env

'connection_mode' => 'all',

'connection_mode' => 'custom',

// config/db-manager.php

'middleware' => ['web', 'auth', 'can:access-db-manager'],

'middleware' => ['web', 'auth', 'role:admin'],

// bootstrap/providers.php
return [
    App\Providers\DbManagerServiceProvider::class,
];

'providers' => [
    App\Providers\DbManagerServiceProvider::class,
],
bash
php artisan vendor:publish --tag=db-manager-config
bash
php artisan vendor:publish --tag=db-manager-provider