Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route::currentRouteName() for Laravel Folio named route returns 'laravel-folio' #89

Closed
richeklein opened this issue Aug 19, 2023 · 2 comments · Fixed by #93
Closed

Route::currentRouteName() for Laravel Folio named route returns 'laravel-folio' #89

richeklein opened this issue Aug 19, 2023 · 2 comments · Fixed by #93
Assignees

Comments

@richeklein
Copy link

richeklein commented Aug 19, 2023

Folio Version

v1.0.0-beta.6

Laravel Version

10.19.0

PHP Version

8.2.3

Description

When using a named route in Laravel Folio the Route::currentRouteName() function returns "laravel-folio" instead of the route name defined in the name function. I'm not sure if this is required for Folio's magic or just unintended.

Steps To Reproduce

  1. create a new Folio page
  2. add a name — e.g. name('about')
  3. the output of Route::currentRouteName() equals "laravel-folio" instead of "about"
@hazwan91
Copy link

I also have the same problem when checking if my current nav-item is active using request()->routeIs('dashboard.index') and it always return false since the current route name keeps giving me laravel-folio as the OP said.

Screenshot 2023-08-21 132325

Currently i have to use request()->is('dashboard') to determine my current page which indicates my folder/file name.

@jdion84
Copy link

jdion84 commented Aug 23, 2023

Routes seem to always use the fallback name, guessing it's something to do with the service provider lifecycle or something.

Route::fallback($this->handler())->name('laravel-folio');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants