Upgrading from 2.0 to 3.0 - routing issues
Hello! I'm currently updating twill to 3.0 from 2.0, and I'm having some issues with routes.
I'm getting the following error:
"Route [admin.index] not defined. (View: /var/www/html/Xerocraft/vendor/area17/twill/views/partials/navigation/_overlay_navigation.blade.php)".
Any clues on what might be causing this?
I run twill under the default "/admin" path:
ADMIN_APP_PATH=admin
Thanks! π
15 Replies
Hi @KyleAF did you run the upgrade script?
if you did, running optimize:clear should help. If not, you need to start there!
Thank you for the response! I just tried optimize:clear. It cleared the cached bootstrap files, but no luck unfortunately π¦
I did run the script prior while upgrading as well.
I wonder if uninstalling and reinstalling might help?
Ok, your twill-navigation file needs to be updated to use twill. instead of admin.
Oh! Can I republish a fresh copy of the twill-navigation config file? Do you happen to know that command?
My twil-navigation config is rather simple, but I suppose it could have changed pretty drastically
You don't need a new one, this format is still compatible, and what I suspected is not in your config, so it's not that
ahh, bummer π¦
In case it means anything, if I comment out the
ADMIN_ROUTE_NAME_PREFIX
from the .env file, then it instead gives the odd error of Route twill..index not definedAlso, in the route:list, it looks like the expected route-name is "admindashboard"?
Also, if I intercept and dump the request it looks like it's accurately routing to the Twill DashboardController
Made progress: I tried competely reinstallting twill and it didn't quite help, but I did discover that if I have one specific one of my module's commented out in twill-naviation, it works:
I can also replicate this on any of the other modules if I misspell their module name, such as:
'pages' => []
to 'pagees' => []
will cause the exact same error
but my "wikimenu" isn't misspelled that I cna figure
Got it figured out! Though I don't think it's necessarily my fault. @ifox it might be worth a read here for code-adjustment maybe? or a documentation-warning about using made-up words for module names. Unless I missed something, or unless you think this is such as edge-case as to not be worth it, lol.
My module name is unusual: "wikimenu". Not a real word. I think the code is making assumptions about what the plural version of this fake word is, because everything works perfectly ONLY if I use the singular-version 'wikimenu' => []
in twill-navigation, whereas all other modules are plural inside twill-navigation. All other references are the same throughout my code as other modules..ha this is indeed an edge case because of Laravel's pluralization that doesn't work correctly with the word "menu". We added this in Twill 3: https://github.com/area17/twill/blob/3b5d66f870fbc46ad67a53e5b61f86711619a144/src/View/Components/Navigation/NavigationLink.php#L170
GitHub
twill/src/View/Components/Navigation/NavigationLink.php at 3b5d66f8...
Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/c...
Seeing your navigation file isn't very long, you could easily convert it to the new approach: https://twillcms.com/docs/getting-started/navigation.html#content-oop-method
Ahh, thank you! I'll look into making the switch. Seems pretty straightforward