Skip to content

Commit

Permalink
Update AdminLayout.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeblauw authored Feb 20, 2025
1 parent 31a5755 commit 3aa585c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/View/Components/Adminlayout/AdminLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ndeblauw\BlueAdmin\View\Components\Adminlayout;

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Illuminate\View\Component;

class AdminLayout extends Component
Expand Down Expand Up @@ -43,7 +44,7 @@ private function findActiveTopLevelMenuItem()
$routename = Route::currentRouteName();

$fake_index_routename = str($routename)->replace(['show', 'create', 'edit'], 'index')->toString();
$current_route = Route::has($fake_index_routename)
$current_route = Str::of($fake_index_routename)->contains('.index') && Route::has($fake_index_routename)
? str(route($fake_index_routename))->replace(config('app.url').'/','')->toString()
: Route::current()->uri; // todo - make more fault tolerant !!! (https etc)

Expand Down

0 comments on commit 3aa585c

Please sign in to comment.