Closed fruitl00p closed 3 months ago
Your routes file should not be loading twice. It's likely that Illuminate\Foundation\Support\Providers\RouteServiceProvider
is somehow booting twice, which might be the result of a configuration problem in your app (e.g. are you extending RouteServiceProvider
with your own class somewhere?).
Breadcrumbs do not belong in your routes file because they cannot be cached. Running php artisan route:cache
will break your breadcrumbs. You should keep them separate.
Sorry to bother you but adding a basic function in my routes/web.php
doesnt error out with a 'function already defined' error, thus the file is actually only loaded once. (it was my false assumption based on the breadcrumbs error)
Thus I still don't understand why when adding the breadcrumbs call to my web.php
file would give 'already defined' errors if I only define the breadcrumb once.
On your last note regarding the seperation of routes and breadcrumbs (which might solve it all anyway) That's a shame as again: I'd love to keep my routes defined and breadcrumbs to go with it as close to eachother as possible.
Thanks for your help and i'll reside to keeping my breadcrumbs separate from the routes :)
Happy to look into the error you're receiving if you can share a reproducible example. I was able to define breadcrumbs in my routes file earlier just fine.
I found the duplication: I also updated the config to point to the web.php
as where my breadcrumbs are defined:
'files' => base_path('routes/web.php'),
This then resulted in the double loading (i assume) Defaulting that back to a non-existing file (i.e base_path('routes/breadcrumbs.php')
or NULL
) solves the issue too and I can have my cake and eat it too ;)
(keeping the routes and crumbs next to eachother)
Hi,
I'm probably running into something that others have aswell but I'd like to question it any just for clearification: I'd like to define the breadcrumb per named route but i'd also like to do it in the same file. This prevents issues with missing routes, parameters or other types of inconsistencies between the to. But it seems it's being loaded twice thus resulting in "Breadcrumb name "home" has already been registered" like errors:
Is there any way to avoid this but have to ability to keep them next to eachother?