tighten / ziggy

Use your Laravel routes in JavaScript.
MIT License
3.86k stars 247 forks source link

route()->current() failed on multiple prefix wildcard (*) #673

Closed sluxzer closed 11 months ago

sluxzer commented 11 months ago

Ziggy version

1.6.0

Laravel version

^10.10

Description

Hi Everyone,

I have this menu inside a dropdown, and I want to highlight if any of the routes is inside,

Menu Name: User Routes:

When I call this function route().current('user.*');

the result is:

I expect everything should be true.

Honestly, I don't want to jump to the conclusion that it's a bug, and if it's not can you explain why? Currently, I made a function to check both user.* and user.role.*

Ziggy call and context

-

Ziggy configuration

-

Route definition

Route::get('/user', [UserController::class, 'index'])->name('user.index');
Route::get('/user/create', [UserController::class, 'create'])->name('user.create');
Route::get('/user/role', [UserController::class, 'index_role'])->name('user.role.index');
Route::get('/user/role/create', [UserController::class, 'create_role'])->name('user.role.create');
sluxzer commented 11 months ago

My bad, everything is working as expected, turns out I got duplicate routes that make this behaviour