Filament - Public Page with Sign In Links to Multiple Panels

2025-05-23

In your application, you might have more than one Filament panel, and you may want to add links to them. However, the path to the panel or the login page slug may change over time. Let's see how to show links to the panel.


Using the Filament helper which resolves to Filament Manager, you can get the panel by its ID.

filament()->getPanel('ID_of_the_panel')

You can get the login URL from here using the getLoginUrl() method.

filament()->getPanel('ID_of_the_panel')->getLoginUrl()

Using this approach, you can show the panels you want. But if you want to show all panels, you can get them all and loop. The easiest way to show anchor text when using this method is to use a brand name.

@foreach(filament()->getPanels() as $panel)
<a href="{{ $panel->getLoginUrl() }}" class="block px-4 py-2 text-gray-700 hover:bg-gray-100">{{ $panel->getBrandName() }}</a>
@endforeach

By default, the brand name is taken from the APP_NAME set in the .env. You can set the brand name in the panel provider using the brandName() method.

return $panel
->default()
->id('tenant')
->path('tenant')
->brandName('Tenant')

Alternatively, a PHP enum class can be used.


Next, when a user is logged in, you wouldn't want to show all the panels. It would be better to show a direct link to the panel the user has access to. We can create a method in the User Model to generate a URL for that.

In this example, the URL is generated based on the user's role.

app/Models/User.php:

use Illuminate\Support\Uri;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
class User extends Authenticatable implements FilamentUser
{
// ...
 
public function getUserPanelLink(): string
{
$panelPath = match ($this->role->name) {
'tenant' => filament()->getPanel('tenant')->getPath(),
'owner' => filament()->getPanel('owner')->getPath(),
'admin' => filament()->getPanel('admin')->getPath(),
};
 
return Uri::to($panelPath);
}
 
public function role(): BelongsTo
{
return $this->belongsTo(Role::class);
}
}

Here, we get the panel path and generate the full URL link using Laravel's Uri helper.

A few of our Premium Examples: