Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cjholowatyj's avatar

Passing on Route Group name prefixes to Inertia/VueJS

So I just started taking advantage of the new name prefixing in route groups (introduced in Laravel 8 I think?) and I've resolved all of the places in my codebase that needed to be renamed when referencing these routes, all except for the VueJS code that I have (using VILT stack). Is anyone aware of a clean way that I can tell VueJS that the route being referenced in Vue as jetstream.workspaces.show should point to the route workspaces.show in my Route Group that is name-prefixed with jetstream.?

Example Route excerpt:

Route::middleware(['web'])->name('jetstream.')->group(function(){
	Route::get('/workspaces/{workspace}',[WorkspaceController::class,'show'])->name('workspaces.show');
});

I'm getting the following console error in my application:

Uncaught (in promise) Error: Ziggy error: route 'jetstream.worskspaces.show' is not in the route list.

Thanks in advance for any help! :)

0 likes
9 replies
jlrdw's avatar

What about the prefix part, like example:

Route::prefix('admin')->group(function () {
    Route::get('/users', function () {
        // Matches The "/admin/users" URL
    });
});

Check that you are using prefixing correctly, just suggestion.

cjholowatyj's avatar

So I believe when i was reading the documentation, the prefix method prefixes either both the route name and the slip or just the slug… which is why I opted for the name prefix method in the route group

apex1's avatar

Try replacing your first name to as, e.g., ->as('jetstream.')

cjholowatyj's avatar

Ok interesting… I’ve definitely seen ->as() used in the code before… by chance you know specifically how it differs from ->name() ? (Just so I know for the future)

apex1's avatar

If I'm correct, name() is for a single route but with as() you can prefix/namespace your route names. So if you have something like as("jetstream.") in your route group then all the route names inside that group will be prefixed with "jetstream.", e.g. "jetstream.workspace.show"

apex1's avatar

Oh wow you're right. I misread your original code and did not see that part. My apologies.

cjholowatyj's avatar

I’m wondering out loud if it is something to do with Ziggy or Inertia maybe…

cjholowatyj's avatar

Nevermind... found a typo in my route functions... on to the next (unrelated) error...

Please or to participate in this conversation.