Laravel/Wayfinder: Creating a single exportable index.ts file which includes all the routes and controller singatures #57069
Unanswered
Chief-spartan-117
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While using Laravel Wayfinder unexpectedly, I encountered one problem of having a single exportable index.ts file to have all the routes and controller signatures, through which I should not have to import different functions from different folders inside the
resources/js/routes/**/*
.I am telling this is that previously, while using the blade template, our architecture used to generate sidebar menus dynamically by storing the menus in the database. Through which the menus were defined in one place and could be used inside the template through the view composer. But to update the architecture from a blade template to an Inertia-based React architecture, the new Laravel Wayfinder was implemented in our project through the project setup done by the CLI. Now, due to time constraints, I have to use Laravel Wayfinder, but the problem arises when I have to dynamically provide the routes for the sidebar menu, which, in the case of Wayfinder, is provided as a function exported from a different index.ts file inside the routes folder.
So, due to this, I had to try different hacks and workarounds to make a single exportable variable to have all the routes function. If there were a single exportable file for the routes, it would be beneficial.
Beta Was this translation helpful? Give feedback.
All reactions