Skip to content

Commit

Permalink
bugfix 🐛 remove debugging info
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeblauw committed Nov 26, 2024
1 parent af44dd0 commit e56a135
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/View/Components/Adminlayout/AdminLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,23 @@ private function findActiveTopLevelMenuItem()
$this->current_route = Route::current()->uri;
$routename = Route::currentRouteName();

dump($this->current_route);
dump($routename);

$fake_index_routename = str($routename)->replace(['show', 'create', 'edit'], 'index')->toString();
$current_route = Route::has($fake_index_routename)
? str(route($fake_index_routename))->replace(config('app.url').'/','')->toString()
: Route::current()->uri;

dump($current_route);
: Route::current()->uri; // todo - make more fault tolerant !!! (https etc)

// Check if it was one of the top level routes
$top_routes = collect(config('blue-admin.fluxmenu.top'))->map( fn($item) => $item['link'])->filter(fn($item) => $current_route == $item);

if( $top_routes->isNotEmpty()){
dump('returning CURRENT_ROUTE');
return $current_route;
}

// Check if it was one of the sidebar routes of a toproute
$list = collect(config('blue-admin.fluxmenu.top'))
->filter( fn($item) => array_key_exists('sidebar', $item))
->map( fn($item) =>
collect($item['sidebar'])->map( fn($l,$k) => ['sidebar' => $l, 'topmenu' => $item['link']])
)->values()->flatten(1);
->map( fn($item) => collect($item['sidebar'])->map( fn($l,$k) => ['sidebar' => $l, 'topmenu' => $item['link']]))
->values()->flatten(1);

//ray($list)->label('List of routes');
//ray($current_route)->label('current route');
Expand All @@ -75,8 +68,6 @@ private function findActiveTopLevelMenuItem()
return $element['topmenu'];
}

dump('NOTHING FOUNT');

return null;
}
}

0 comments on commit e56a135

Please sign in to comment.