Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensures filament.xxx.home is always available #15281

Closed
wants to merge 1 commit into from

Conversation

bilogic
Copy link

@bilogic bilogic commented Jan 8, 2025

Description

Addresses #15257

  1. Ensures that the route name filament.<panel-id>.home won't be overwritten when the dashboard page is used
  2. The route / still works with or without the dashboard, so backwards compatible

Visual changes

None

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@danharrin
Copy link
Member

Can you redirect between panels by generating a URL like Filament::getPanel('admin')->getUrl()? I don't like the idea of having a route that doesn't do anything to be honest

@danharrin
Copy link
Member

danharrin commented Jan 9, 2025

Gonna close this because of the above, but please let me know what I am missing, I think it should be relatively easy to generate a URL for each panel without needing the ghost route. I can reopen if you let me know how I am wrong.

@danharrin danharrin closed this Jan 9, 2025
@bilogic
Copy link
Author

bilogic commented Jan 9, 2025

Can you redirect between panels by generating a URL like Filament::getPanel('admin')->getUrl()? I don't like the idea of having a route that doesn't do anything to be honest

I wouldn't say it does nothing. It had to be this way so that no existing project will break, I'm sure there are some folks who hard coded the URL of / for dashboards.

The alternative is to change dashboard's $routePath to be /dashboard as shared here #15257

While Filament::getPanel('admin')->getUrl() is a way to get the URL, the Laravel convention of route('a.b.c') is much easier remember and to look up using artisan, I mean afterall, Filament did name every panel with a home route, except that it is now overwritten by Dashboard.

And that is main issue I'm trying to address: the inconsistency.

If dashboard is not used, home route exists, but if dashboard was used, home does not exists. It took quite a bit of debugging to figure this out, if this PR is merged, it should save others from this trouble.

@danharrin
Copy link
Member

In Filament, you should never really rely on route names for anything, even pages in a resource. Route names are internally generated and used, and are subject to change. The reason why we have the getUrl() helpers on the panel, resources and pages is to allow you not to have to consider the route name. Avoiding hard-coded route names will make major version upgrades easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants