Baspa
Baspa
FFilament
Created by Baspa on 9/27/2024 in #❓┊help
Wizard customize previous action
I want to customize the previous action when using the Filament Wizard. I would like to fire a Livewire event when the button is pressed. Using ->previousAction to override the current action seems not possible. I guess the action is handled internally by Filament. Is is possible to know when a user pressed the 'previous' button?
1 replies
FFilament
Created by Baspa on 9/11/2024 in #❓┊help
Access to the tenantId in the panel or middleware of a package
Is it possible to get the current tenantId in the panel or middleware of a Filament plugin? Haven't been able to get it yet, I'm curious if it's possible at all.
4 replies
FFilament
Created by Baspa on 8/14/2024 in #❓┊help
`replaceMountedAction()` seems not to be available in the `modalCancelAction` is that correct?
I tried using the replaceMountedAction() method in the modalCancelAction action but it doesn't do anything. Is it correct that it can't be used there? Or is there any workaround? I want to have two buttons in a modal that go to another action modal.
1 replies
FFilament
Created by Baspa on 8/8/2024 in #❓┊help
Unable to find component when clicking on an action
I have a custom action in a custom Filament page:
// ...
use Filament\Actions\Action;
// ...

class LoginTwoFactor extends Page implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithFormActions;

protected static string $layout = 'filament.layouts.login';

public function mount(): void
{
$this->form->fill();
}

public function resendAction(): Action
{
return Action::make('resend')
->label('Opnieuw versturen')
->color('info')
->action(function ($data) {

auth()->user->notify(app(SendOTP::class));
});
}

// ...
}
// ...
use Filament\Actions\Action;
// ...

class LoginTwoFactor extends Page implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithFormActions;

protected static string $layout = 'filament.layouts.login';

public function mount(): void
{
$this->form->fill();
}

public function resendAction(): Action
{
return Action::make('resend')
->label('Opnieuw versturen')
->color('info')
->action(function ($data) {

auth()->user->notify(app(SendOTP::class));
});
}

// ...
}
When I click on the action button it gives me the following error:
Unable to find component: [app.filament.pages.auth.login-two-factor]
To me it's totally unclear where this message comes from. I never reference the mentioned view? Can someone explain to me what's actually happening? If you need more code or information I will provide it.
4 replies
FFilament
Created by Baspa on 7/5/2024 in #❓┊help
Stack component does not seem to respect `alignment`
No description
4 replies
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