![image](https://private-user-images.githubusercontent.com/604907/330077556-cadb4346-d3fe-4749-ba6e-0e4eed2c9576.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE5ODY1NjgsIm5iZiI6MTcyMTk4NjI2OCwicGF0aCI6Ii82MDQ5MDcvMzMwMDc3NTU2LWNhZGI0MzQ2LWQzZmUtNDc0OS1iYTZlLTBlNGVlZDJjOTU3Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNlQwOTMxMDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMmIxZGZjNmI1NmFiZDY3YjgwZDNjYWM0ZDViNjUzOTc3M2IxNWMzMGE4N2U1MWE4MjYyZDM2M2QwN2QwNjY1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.-280x4VbLkxFPLQcywQLyfkewseGZkJnZdcoyxdF4U0)
![image](https://private-user-images.githubusercontent.com/604907/330077684-f41809b0-3ef0-4dd9-a894-ff199050ca2d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE5ODY1NjgsIm5iZiI6MTcyMTk4NjI2OCwicGF0aCI6Ii82MDQ5MDcvMzMwMDc3Njg0LWY0MTgwOWIwLTNlZjAtNGRkOS1hODk0LWZmMTk5MDUwY2EyZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNlQwOTMxMDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04OGZjYmY0NTYzMzdkYWNkYWMzMWYxODNmMDIzZTI0OWRmMmMwNDgyNmIzZjNjYjI1YWViOTg1NmU2N2Q0YzY5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.rvDHyPGWf76DeZBfIWJAvtncIJ5m8UGe-jjIyzEMEbs)
This package allows to add widgets and define the layout of the dashboard page on a per-user basic. This package uses Laravel model settings package to ensure persistence of data in the database.
You can install the package via composer:
composer require invaders-xx/filament-gridstack-dashboard
php artisan filament:assets
Note: Add plugin Blade files to your custom theme
tailwind.config.js
for dark mode.To set up your own custom theme, you can visit the official instruction page on the Filament website.
Add the plugin's views to your tailwind.config.js
file.
content: [
'<path-to-vendor>/invaders-xx/filament-gridstack-dashboard/resources/**/*.blade.php',
]
Please visit Laravel model settings to configure your User model to use this package.
You can publish the config file with:
php artisan vendor:publish --tag="filament-gridstack-dashboard-config"
This is the contents of the published config file:
return [
];
There is no option at the moment.
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-gridstack-dashboard-views"
use InvadersXX\FilamentGridstackDashboard\GridstackDashboardPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GridstackDashboardPlugin::make()
])
}
You can configure the number of columns of the grid. Default is 12.
use InvadersXX\FilamentGridstackDashboard\GridstackDashboardPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GridstackDashboardPlugin::make()
->columns(3),
])
}
You can configure the number of rows of the grid. Default is 0 (no constraint).
use InvadersXX\FilamentGridstackDashboard\GridstackDashboardPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GridstackDashboardPlugin::make()
->rows(3),
])
}
You can configure the settings path (string in dotted format where to store in the settings) By default the path is 'dashboard.layout'
use InvadersXX\FilamentGridstackDashboard\GridstackDashboardPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GridstackDashboardPlugin::make()
->settingsPath('dashboard.settings'),
])
}
You can configure the navigationIcon, the navigationGroup and the navigationSort
use InvadersXX\FilamentGridstackDashboard\GridstackDashboardPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GridstackDashboardPlugin::make()
->navigationIcon('heroicon-o-chart-bar')
->navigationGroup('Admin')
->navigationSort(1),
])
}
You can configure a default grid using defaultGrid() function. This function has an array as parameter. This array should have the following format:
[
'widget' => AccountWidget::class, // Widget class
'x' => 0, // starting column on the grid
'y' => 0, // row on the grid
'w' => 12, // number of columns on the grid
]
FYI, a 12 columns grid, x goes from 0 to 11
use InvadersXX\FilamentGridstackDashboard\GridstackDashboardPlugin;
use Filament\Widgets\AccountWidget;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GridstackDashboardPlugin::make()
->defaultGrid([
[
'widget' => AccountWidget::class,
'x' => 0,
'y' => 0,
'w' => 12,
],
]),
])
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.