FrazeColder's avatar

Composer package: How to access global (Laravel) routes

Hello,

at the moment I am coding a composer package which is providing me some basic function to write tests for Laravel Nova. However, I want to access some standard routes in my package like route('nova.index').

The problem is that I cannot simply call route('nova.index') because then I get the error Symfony\Component\Routing\Exception\RouteNotFoundException: Route [nova.index] not defined.. But this is only because my package simply cannot access any routes from my actual Laravel project.

So, this brings me to my questions: How can I access routes in my own coded composer project?

I know how to register additional routes in a composer package, but that is not what I want. I want to access already available routes. Any ideas?

Kind regards

0 likes
2 replies
neilstee's avatar

@frazecolder can you try accessing it using Illuminate\Support\Facades\Route instead of helper functions?

Please or to participate in this conversation.