Skip to content

Commit

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

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

class Header extends Component
Expand Down Expand Up @@ -34,7 +35,7 @@ public 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;

Expand Down

0 comments on commit 31a5755

Please sign in to comment.