how to set the widget to full for each widget in custom Dashbaord
class Dashboard extends Page
{
protected static string $routePath = '/';
protected int | string | array $columnSpan = 'full';
protected static ?int $navigationSort = -2;
protected static string $view = 'filament.pages.dashboard';
public static function getNavigationLabel(): string
{
return static::$navigationLabel ??
static::$title ??
__('filament-panels::pages/dashboard.title');
}
public function getTitle(): string|Htmlable
{
return static::$title ?? __('filament-panels::pages/dashboard.title');
}
public static function getRoutePath(): string
{
return static::$routePath;
}
public function getHeaderWidgets(): array
{
return [
AccountWidget::class,
BadgeWidget::class,
];
}
public static function getNavigationIcon(): string|Htmlable|null
{
return static::$navigationIcon
?? FilamentIcon::resolve('panels::pages.dashboard.navigation-item')
?? (Filament::hasTopNavigation() ? 'heroicon-m-home' : 'heroicon-o-home');
}
}
class Dashboard extends Page
{
protected static string $routePath = '/';
protected int | string | array $columnSpan = 'full';
protected static ?int $navigationSort = -2;
protected static string $view = 'filament.pages.dashboard';
public static function getNavigationLabel(): string
{
return static::$navigationLabel ??
static::$title ??
__('filament-panels::pages/dashboard.title');
}
public function getTitle(): string|Htmlable
{
return static::$title ?? __('filament-panels::pages/dashboard.title');
}
public static function getRoutePath(): string
{
return static::$routePath;
}
public function getHeaderWidgets(): array
{
return [
AccountWidget::class,
BadgeWidget::class,
];
}
public static function getNavigationIcon(): string|Htmlable|null
{
return static::$navigationIcon
?? FilamentIcon::resolve('panels::pages.dashboard.navigation-item')
?? (Filament::hasTopNavigation() ? 'heroicon-m-home' : 'heroicon-o-home');
}
}
use App\Enums\Status;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use App\Models\House;
class BadgeWidget extends BaseWidget
{
protected static string $view = 'filament.widgets.badge-widget';
protected int | string | array $columnSpan = 'full';
public function getRecords()
{
return House::all();
}
public function getBadgeColor($status)
{
return match ($status) {
Status::SOLD => 'success',
Status::RESERVATION => 'danger',
Status::DAILY => 'warning',
Status::COMPANY => 'primary',
Status::AVAILABLE => 'info',
default => 'gray',
};
}
}
use App\Enums\Status;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use App\Models\House;
class BadgeWidget extends BaseWidget
{
protected static string $view = 'filament.widgets.badge-widget';
protected int | string | array $columnSpan = 'full';
public function getRecords()
{
return House::all();
}
public function getBadgeColor($status)
{
return match ($status) {
Status::SOLD => 'success',
Status::RESERVATION => 'danger',
Status::DAILY => 'warning',
Status::COMPANY => 'primary',
Status::AVAILABLE => 'info',
default => 'gray',
};
}
}
3 Replies
Try adding this to your dashboard:
The default columns is 2 for the dashboard.
Reference: https://filamentphp.com/docs/3.x/panels/dashboard#customizing-the-widgets-grid
public function getColumns(): int | string | array
{
return 1;
}
public function getColumns(): int | string | array
{
return 1;
}
I just added that but look same ,not worked.