© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
Jon Mason

Defining Additional parameters on URL

In my app I have locations, and there's a relationship to month ends. When navigating, I'd like to have my urls be like this as an example:

/locations/{location_id}/month-end/202311
/locations/{location_id}/month-end/202311


The only way that I've seen it work is more like
/locations/{location_id}/month-end?yearMonth=202311
/locations/{location_id}/month-end?yearMonth=202311
, which is fine I guess, but I was hoping there is an easy way to not use url parameters if I don't have to.

I've tried modifying the
$slug
$slug
property in my resource class, which seems to have some effect, but then I get an error that I'm missing parameters
location
location
and
yearMonth
yearMonth
.

If I supply those paremeters it seems to get angry that I haven't supplied the
record
record
parameter.

I'm a little confused about how the urls are defined as I'm used to just defining them explicitly in the web.php routes file.

class MonthEndTaskResource extends Resource
{
    protected static ?string $model = MonthEndTask::class;

    protected static ?string $navigationIcon = 'heroicon-o-calendar-days';

    protected static bool $shouldRegisterNavigation = false;

    // protected static ?string $slug = 'locations/{location}/month-end/{yearMonth}'; <--this causes problems.

   ...    

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListMonthEndTasks::route('/'),
            'create' => Pages\CreateMonthEndTask::route('/create'),
            'edit' => Pages\EditMonthEndTask::route('/{yearMonth}'),
        ];
    }
class MonthEndTaskResource extends Resource
{
    protected static ?string $model = MonthEndTask::class;

    protected static ?string $navigationIcon = 'heroicon-o-calendar-days';

    protected static bool $shouldRegisterNavigation = false;

    // protected static ?string $slug = 'locations/{location}/month-end/{yearMonth}'; <--this causes problems.

   ...    

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListMonthEndTasks::route('/'),
            'create' => Pages\CreateMonthEndTask::route('/create'),
            'edit' => Pages\EditMonthEndTask::route('/{yearMonth}'),
        ];
    }
Solution
e.g.
image.png
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Persist url parameters on page update
FilamentFFilament / ❓┊help
15mo ago
URL Query Parameters on Filament Resource
FilamentFFilament / ❓┊help
2y ago
TextInput url too few parameters
FilamentFFilament / ❓┊help
7mo ago
Custom Page with URL parameters
FilamentFFilament / ❓┊help
3y ago