PHP code example of sridhar-s-subramanian / filament-dbview
1. Go to this page and download the library: Download sridhar-s-subramanian/filament-dbview 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/ */
sridhar-s-subramanian / filament-dbview example snippets
use SridharSSubramanian\FilamentDbview\DbviewPlugin;
public function panel(Panel $panel): Panel
{
return $panel->plugin(DbviewPlugin::make());
}
$panel->plugin(
DbviewPlugin::make()
->history() // persist + show per-user query history
);
$panel->plugin(
DbviewPlugin::make()
->allTables() // list + allow every table on allowed connections
// Optional: still block a few sensitive framework tables
->denyTables(['password_reset_tokens', 'sessions', 'personal_access_tokens']),
);
// config/filament-dbview.php
'models' => [
'paths' => [
app_path('Models'),
// app_path('Domain/Orders/Models'),
],
// Global denylist — these models never appear in the Browser / models-scope Runner
'exclude' => [
// \App\Models\PersonalAccessToken::class,
// \App\Models\Passport\Token::class,
// \App\Models\Admin::class,
],
'cache' => [
'enabled' => env('FILAMENT_DBVIEW_CACHE', true),
'store' => null,
'key' => 'filament-dbview.registry',
'ttl' => 3600, // null = cache until filament-dbview:clear
],
],
'authorization' => [
// Leave as null to allow every authenticated panel user (default).
'gate' => 'viewDbview',
// Optional: tighter control for the Query Runner (raw SELECT console).
// If set, the user must pass both `gate` and this ability.
'query_runner_gate' => 'runDbviewQueries',
// Optional: hide / block tables the user may not see.
// The Gate is invoked as: allows('viewDbviewTable', $tableName)
'table_gate' => 'viewDbviewTable',
// Optional: who may download CSV/JSON (null = any user who can run queries).
'export_gate' => 'exportDbview',
],