How to set the Dashboard columns to 3 using custom widgets
How can I make this 3 columns?
<?php
namespace App\Filament\Pages;
use Filament\Pages\Dashboard as BasePage;
class Dashboard extends BasePage
{
protected function getColumns(): int | array
{
return 3;
}
}
?>
12 Replies
Yes. Have you tried making that getColumns function
public
instead of protected?(If you look at the \Filament\Pages\Dashboard class which you're extending, you'll see that it's public there, and you're overriding that) ... https://github.com/filamentphp/filament/blob/f14ec4205db67bf83a02d344fc8e923594676473/packages/panels/src/Pages/Dashboard.php#L67-L73
GitHub
filament/packages/panels/src/Pages/Dashboard.php at f14ec4205db67bf...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
In my case
works properly.
is correct, are thoes widgets widgets or cards in a widget
I created it with this command https://filamentphp.com/docs/2.x/admin/dashboard/getting-started#custom-widgets
Ok... so the above will work in the dashboard class.
I wonder why it is still not working
Did you replace the default dashboard class with your new one in the config as per the docs
is this the correct file structure?It is insidre the resources folder before and I move it and it's working but I have this issue now
Yes... then you need to map it in the filament config
The duplicate is probably because the default config already lists the default dashboard page. Delete that one from your panel config.
If it still not working try this using only int protected function getColumns(): int
{
return 3;
}