© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
TheRealTeeHill

Pass URL parameter from Page to Widget

I have a page that calls a widget
<?php

namespace App\Filament\Pages;

use App\Filament\Resources\VesselLocationResource\Widgets\VesselLocationGoogleMapWidget;
use Filament\Pages\Page;
use Illuminate\Http\Request;

class VesselFinder extends Page
{
    public $fleet;

    protected static ?string $navigationIcon = 'icon-map';

    protected static ?string $navigationGroup = 'Maritime Overview';

    protected static ?int $navigationSort = 5;

    protected static string $view = 'filament.pages.vessel-finder';

    public function mount(Request $request)
    {
        $this->fleet = $request->query('fleet');
    }

    protected function getHeaderWidgets(): array
    {
        return [
            VesselLocationGoogleMapWidget::class,
        ];
    }

    protected function getHeaderWidgetsData(): array
    {
        return [
            'fleet' => $this->fleet,
        ];
    }
}
<?php

namespace App\Filament\Pages;

use App\Filament\Resources\VesselLocationResource\Widgets\VesselLocationGoogleMapWidget;
use Filament\Pages\Page;
use Illuminate\Http\Request;

class VesselFinder extends Page
{
    public $fleet;

    protected static ?string $navigationIcon = 'icon-map';

    protected static ?string $navigationGroup = 'Maritime Overview';

    protected static ?int $navigationSort = 5;

    protected static string $view = 'filament.pages.vessel-finder';

    public function mount(Request $request)
    {
        $this->fleet = $request->query('fleet');
    }

    protected function getHeaderWidgets(): array
    {
        return [
            VesselLocationGoogleMapWidget::class,
        ];
    }

    protected function getHeaderWidgetsData(): array
    {
        return [
            'fleet' => $this->fleet,
        ];
    }
}


I want to pass a variable via the URL to the widget so I can filter the widget data - http://mysite.com/admin/vessel-finder?fleet=north

How can I collect "fleet" in the VesselLocationGoogleMapWidget?

Cheers
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Give parameter to widget from page
FilamentFFilament / ❓┊help
3y ago
Pass data to widget from custom page
FilamentFFilament / ❓┊help
2y ago
pass data to widget from custom page
FilamentFFilament / ❓┊help
3y ago
Pass parameter from URL to table header action
FilamentFFilament / ❓┊help
2y ago