F
Filament11mo ago
Forever

Route everything that is /mypage/* to mypage

My Goal: I want to integrate our old system via iframe loading the route /mypage/PATH/TO/OLD/RESOURCE. without ->tenant(Tenant::class) enabled it works like it should when i add a route: like this:
Route::get('/page/{oldResource}', \App\Filament\ERP\Pages\Boot::class)->where('oldResource', '.*');
Route::get('/page/{oldResource}', \App\Filament\ERP\Pages\Boot::class)->where('oldResource', '.*');
But when i enable the tenant part it complains:
Filament\FilamentManager::getTenantName(): Argument #1 ($tenant) must be of type Illuminate\Database\Eloquent\Model, null given,
Filament\FilamentManager::getTenantName(): Argument #1 ($tenant) must be of type Illuminate\Database\Eloquent\Model, null given,
calling /page works correnctly i also tried
Route::get('m/{tenant}/page/{oldResource}', \App\Filament\ERP\Pages\Boot::class)->where('oldResource', '.*');
Route::get('m/{tenant}/page/{oldResource}', \App\Filament\ERP\Pages\Boot::class)->where('oldResource', '.*');
Solution:
```php //Overriding in my Page public static function routes(Panel $panel): void { parent::routes($panel);...
Jump to solution
3 Replies
Forever
ForeverOP11mo ago
i also tried a "vanilla" larvel controller but then im losing the filament Panel. So it seems i got it somehow working with:
Solution
Forever
Forever11mo ago
//Overriding in my Page
public static function routes(Panel $panel): void
{
parent::routes($panel);

Route::get(static::getRoutePath()."/{oldResource}", static::class)
->middleware(static::getRouteMiddleware($panel))
->withoutMiddleware(static::getWithoutRouteMiddleware($panel))
->name(static::getRelativeRouteName())
->where("oldResource",".*");
}
//Overriding in my Page
public static function routes(Panel $panel): void
{
parent::routes($panel);

Route::get(static::getRoutePath()."/{oldResource}", static::class)
->middleware(static::getRouteMiddleware($panel))
->withoutMiddleware(static::getWithoutRouteMiddleware($panel))
->name(static::getRelativeRouteName())
->where("oldResource",".*");
}
next Step: How do i access oldResource in my view
Forever
ForeverOP11mo ago
So i ended up just extracting the part i need from
request()->path()
request()->path()
Want results from more Discord servers?
Add your server