Change data in default Filament Info Widget

Hi, i just wondering how to change the data in default filament info widget since that in vendor . I try to overide in vendor and its work but it will back to default when i run composer update . Is there any other alternative to do without create a new widget ?
5 Replies
Vp
Vp7mo ago
I don't think so, why not just creating a new one and remove/hide default?
Expecto Patronum
Expecto PatronumOP7mo ago
Because the default widget at the center of the page . And the sizing of both widget are same . So i want to change the data in filament info to make it align with account info widget .
Vp
Vp7mo ago
Ok, then you can do like this. 1. create a class Widgets\CustomWidget.php inside FIlament
<?php

namespace Filament\Widgets;

class CustomWidget extends Widget
{
protected static ?int $sort = -2;

protected static bool $isLazy = false;

/**
* @var view-string
*/
protected static string $view = 'custom-widget';
}
<?php

namespace Filament\Widgets;

class CustomWidget extends Widget
{
protected static ?int $sort = -2;

protected static bool $isLazy = false;

/**
* @var view-string
*/
protected static string $view = 'custom-widget';
}
And inside custom-widget.blade.php (https://github.com/filamentphp/filament/blob/3.x/packages/panels/resources/views/widgets/filament-info-widget.blade.php)
<x-filament-widgets::widget class="fi-filament-info-widget">
<x-filament::section>
// ...
</x-filament::section>
</x-filament-widgets::widget>
<x-filament-widgets::widget class="fi-filament-info-widget">
<x-filament::section>
// ...
</x-filament::section>
</x-filament-widgets::widget>
In panel provider
use Filament\Widgets\CustomWidget;

return $panel
->widgets([
Widgets\AccountWidget::class,
// Widgets\FilamentInfoWidget::class,
CustomWidget::class,
])
use Filament\Widgets\CustomWidget;

return $panel
->widgets([
Widgets\AccountWidget::class,
// Widgets\FilamentInfoWidget::class,
CustomWidget::class,
])
Vp
Vp7mo ago
Result
No description
Expecto Patronum
Expecto PatronumOP7mo ago
Great . Will apply based on your suggestion . Thanks again bro .
Want results from more Discord servers?
Add your server