Baspa
Baspa
FFilament
Created by Baspa on 5/24/2024 in #❓┊help
Dynamically set the order for the widgets on each page
No description
3 replies
FFilament
Created by Baspa on 4/17/2024 in #❓┊help
The columnSpan on widgets is not working
It seems like the columnSpan property on the Widget class does not have any effect at all unless I'm using full as value. For example 6/12 or 4/12 does not work and displays the widget as 1/12. I have this Dashboard page:
class Dashboard extends \Filament\Pages\Dashboard
{
public function getWidgets(): array
{
return [];
}

public function getHeaderWidgetsColumns(): int | array
{
return 12;
}


protected function getHeaderWidgets(): array
{
return [
Test::class,
TestOfWat::class,
];
}
}
class Dashboard extends \Filament\Pages\Dashboard
{
public function getWidgets(): array
{
return [];
}

public function getHeaderWidgetsColumns(): int | array
{
return 12;
}


protected function getHeaderWidgets(): array
{
return [
Test::class,
TestOfWat::class,
];
}
}
And this widget:
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;

class TestOfWat extends Widget
{
protected static string $view = 'filament.widgets.test-of-wat';

protected int | string | array $columnSpan = '4/12';
}
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;

class TestOfWat extends Widget
{
protected static string $view = 'filament.widgets.test-of-wat';

protected int | string | array $columnSpan = '4/12';
}
But the width of the widget is always set to 1/12. Unless I set it to 'full'. How should I set it properly? I can't find clear documentation on the website about this.
10 replies
FFilament
Created by Baspa on 4/12/2024 in #❓┊help
ColumnSpan not working at all
No description
1 replies
FFilament
Created by Baspa on 3/29/2024 in #❓┊help
How to prefix some routes or pages like ListRecords with '/admin' while others don't have the prefix
I want a few routes in my app to have the 'admin' prefix while the others should remain intact. Is there an built-in way to do this?
4 replies
FFilament
Created by Baspa on 3/28/2024 in #❓┊help
The `columnSpan` property is overridden in each render
On the first render it appears as a full columnspan. But on a second render it reverts back to 1/2 as it seems. Any idea what might causing this? I guess it has something to do with the render method?
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;
use Illuminate\Support\Carbon;
use App\Domain\Widget\Actions\GetWeather;
use App\Domain\Widget\Actions\GetForecast;
use Illuminate\Contracts\View\View;

class WeatherWidget extends Widget
{
public array $report;
public ?string $forecast = null;
public string $time;

public string $width;
public int $order;

protected static string $view = 'filament.widgets.weather';

protected int | string | array $columnSpan = 'full';

public function render(): View
{
$this->report = GetWeather::run();
$this->forecast = GetForecast::run(
lat: 51.4946, // Bergen op Zoom
long: 4.2872
);

$this->time = $this->forecast ? Carbon::parse($this->forecast)->format('H:i') : '';

return view(static::$view, [
'report' => $this->report,
'forecast' => $this->forecast,
'time' => $this->time,
]);
}
}
<?php

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;
use Illuminate\Support\Carbon;
use App\Domain\Widget\Actions\GetWeather;
use App\Domain\Widget\Actions\GetForecast;
use Illuminate\Contracts\View\View;

class WeatherWidget extends Widget
{
public array $report;
public ?string $forecast = null;
public string $time;

public string $width;
public int $order;

protected static string $view = 'filament.widgets.weather';

protected int | string | array $columnSpan = 'full';

public function render(): View
{
$this->report = GetWeather::run();
$this->forecast = GetForecast::run(
lat: 51.4946, // Bergen op Zoom
long: 4.2872
);

$this->time = $this->forecast ? Carbon::parse($this->forecast)->format('H:i') : '';

return view(static::$view, [
'report' => $this->report,
'forecast' => $this->forecast,
'time' => $this->time,
]);
}
}
1 replies
FFilament
Created by Baspa on 12/27/2023 in #❓┊help
How to populate multi select list with default selected values
I have this multiple select form field where I load the options and try to set the default values:
Forms\Components\Select::make('platforms')
->options(function () {
return Platform::query()
->get()
->mapWithKeys(fn ($platform) => [$platform->id => $platform->name]);
})
->label(__('Platforms'))
->default(function () {
return ChannelPlatformFrequency::query()
->where('channel_id', request()->route('record'))
->get()
->mapWithKeys(fn ($channelPlatformFrequency) => [$channelPlatformFrequency->platform_id => $channelPlatformFrequency->platform->name]);
})
->multiple()
->required(),
Forms\Components\Select::make('platforms')
->options(function () {
return Platform::query()
->get()
->mapWithKeys(fn ($platform) => [$platform->id => $platform->name]);
})
->label(__('Platforms'))
->default(function () {
return ChannelPlatformFrequency::query()
->where('channel_id', request()->route('record'))
->get()
->mapWithKeys(fn ($channelPlatformFrequency) => [$channelPlatformFrequency->platform_id => $channelPlatformFrequency->platform->name]);
})
->multiple()
->required(),
The default method does not seem to work. It does not show any selected options. As far as I know I should use the default option to set the default selected values. As you can see in the image I attached the available options (up) and the default values (down) should match.
9 replies
FFilament
Created by Baspa on 12/6/2023 in #❓┊help
Syntax error, unexpected token ";", expecting "]"
I just did a fresh installation and get the following error when redirecting to the link: https://secure-link.test/abc/login The error seems to occur in vendor/filament/support/resources/views/components/modal/index.blade.php. This is my provider, which I included in the app.php config:
<?php

namespace App\Providers\Filament;

// ...

class AbcPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('abc')
->path('abc')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authGuard('backend')
->authMiddleware([
Authenticate::class,
]);
}
}
<?php

namespace App\Providers\Filament;

// ...

class AbcPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('abc')
->path('abc')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authGuard('backend')
->authMiddleware([
Authenticate::class,
]);
}
}
4 replies