How do I do custom route for a specific panel page?

This probably sound very confusing, but let me explain So we had to do an integration with a very important api. it's ur typical oauth flow, shows a page to ask for permission, redirect to the provider website, provider website ask user to login, then it redirects back then we can fetch data from the provider with the user consent and prefill a form Problem however is that provider insist our url path to be say: 127.0.0.1/provider-integration-local/ (for local environment) our-domain.com/provider-integration-prod/ (for prod environment) So as u can see when redirecting to their site, it must come from /provider-integration/ on our site and when they redirect back, it must be to /provider-integration/ on our site We requested if it is possible to use a different url path but they insist no. they do not allow changing the url path on our side (it's a government api and they insist their decision is final, the url path is decided by them) So as u may have guessed, this is a problem because paths in a filament panel follow this structure by default our-domain.com/panel-id/resource-path/whatever-path I tried to do this in routes/web.php
use Filament/CustomerPanel/Item/Pages/CreateItem;

if (app()->isLocal()) {
Route::get('/provider-integration-local/', CreateItem::class)
} elseif (app()->isProduction() {
Route::get('/provider-integration', CreateItem::class)
}
use Filament/CustomerPanel/Item/Pages/CreateItem;

if (app()->isLocal()) {
Route::get('/provider-integration-local/', CreateItem::class)
} elseif (app()->isProduction() {
Route::get('/provider-integration', CreateItem::class)
}
But I got these errors instead each time Unable to find component: [filament.livewire.global-search] Unable to find component: [filament.livewire.database-notifications] the panel colours is also the default filament panel colours instead of the one I specified for my customer panel So how could i continue to have this form and page in my filament customer panel? Any good workarounds?
6 Replies
pocket.racer
pocket.racer11mo ago
to give a better TLDR Due to an external API silly hard requirements, I need to change my-domain.com/panel-path/resource-name/create to my-domain.com/some-very-custom-path With: - no errors - stylings, settings of that panel applied instead of the default one But how do i do so? bump
Patrick Boivin
Patrick Boivin11mo ago
You want a page to belong inside of a panel, but with a url that's outside of the panel?
pocket.racer
pocket.racer11mo ago
yea something like that. Not by my choice but forced upon me by the external api partner The page belongs inside the filament panel but the url path to that panel's page must be a custom one decided by that external api partner (the government in this case [and also different url path depending if it's local, staging or prod environment])
Patrick Boivin
Patrick Boivin11mo ago
I'm not sure this is possible... or maybe it is, but probably outside of my depth. I think an alternative solution would be to have your outside route render a custom Livewire component, and reuse some of the Blade components from Filament to match the look of the Panel.
Andrew Wallo
Andrew Wallo11mo ago
@pocket.racer I think the only way to go about doing this is to create a Middleware to redirect the requests coming to /provider-integration/ to the appropriate Filament panel URL. The same middleware could also handle the OAuth redirect back to your application.
pocket.racer
pocket.racer11mo ago
Thank you, that's an angle i didn't thought of
Want results from more Discord servers?
Add your server
More Posts