F
Filament11mo ago
morty

How can I get the current panel with a custom route?

I have two panels, portal on /portal and admin on /admin. The portal panel is the "default" panel. If I have a route like the following, how can I have Filament register the panel based on the path?
Route::get('/admin/test', function () {
dd(Filament::getCurrentPanel()); // wrong panel (gets default panel which is portal)
});
Route::get('/admin/test', function () {
dd(Filament::getCurrentPanel()); // wrong panel (gets default panel which is portal)
});
3 Replies
awcodes
awcodes11mo ago
What are you actually trying to do?
morty
mortyOP11mo ago
Trying to get the url for the panel (to redirect to) with Filament::getUrl() on a custom route (Laravel Socialite callback url). The portal panel uses the default login with email/password but the admin panel uses Laravel Socialite only via Microsoft Azure. I've gotten around the issue by doing this on both panel providers:
->default(Request::is('portal/*'))
->default(Request::is('portal/*'))
and
->default(Request::is('admin/*'))
->default(Request::is('admin/*'))
not sure if there is a better way Is there a middleware or something that runs that sets the current panel with a normal Filament route? How does Filament determine the current panel?
awcodes
awcodes11mo ago
GitHub
filament/packages/panels/routes/web.php at 3.x · filamentphp/filament
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Want results from more Discord servers?
Add your server