Forever
Forever
FFilament
Created by Forever on 1/29/2024 in #❓┊help
Third Layer Navigation.
Im tryint to setup a third layer of navigation using the navigation builder on the panel i defnied:
->navigation(function (NavigationBuilder $builder): NavigationBuilder {

$builder->groups(
array_merge(
[NavigationGroup::make('Dashboard')->items([NavigationItem::make('Dashboard')->url('/boot/dashboard.asp')->icon('heroicon-o-home')])],
Modul::query()
->where('hidden', 0)
->orderBy('OrderId')
->get()
->map(fn (Modul $modul) => $modul->getNavigationGroup())
->toArray()
));

return $builder;
});
->navigation(function (NavigationBuilder $builder): NavigationBuilder {

$builder->groups(
array_merge(
[NavigationGroup::make('Dashboard')->items([NavigationItem::make('Dashboard')->url('/boot/dashboard.asp')->icon('heroicon-o-home')])],
Modul::query()
->where('hidden', 0)
->orderBy('OrderId')
->get()
->map(fn (Modul $modul) => $modul->getNavigationGroup())
->toArray()
));

return $builder;
});
Modul is just an Model with function:
use Filament\Navigation\NavigationGroup as FilamentNavigationGroup;

public function getNavigationGroup(): NavigationGroup
{
$navigationItems = $this->menuItems()->where('unlocked', '=', 1)->whereNull("parent")->get()->map(fn (NavigationItem $navigationItem) => $navigationItem->registerAsNavigationItem())->toArray();

return FilamentNavigationGroup::make($this->LabelDE)
->icon(preg_match('/class\s*=\s*["\']([^"\']+)["\']/', $this->icon, $matches) ? $matches[1] : '')
->items($navigationItems)
->collapsed(true);
}
use Filament\Navigation\NavigationGroup as FilamentNavigationGroup;

public function getNavigationGroup(): NavigationGroup
{
$navigationItems = $this->menuItems()->where('unlocked', '=', 1)->whereNull("parent")->get()->map(fn (NavigationItem $navigationItem) => $navigationItem->registerAsNavigationItem())->toArray();

return FilamentNavigationGroup::make($this->LabelDE)
->icon(preg_match('/class\s*=\s*["\']([^"\']+)["\']/', $this->icon, $matches) ? $matches[1] : '')
->items($navigationItems)
->collapsed(true);
}
26 replies
FFilament
Created by Forever on 1/26/2024 in #❓┊help
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', '.*');
7 replies