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

vajricaaaa's avatar

Route not defined.

Hello. I have some issue in defining routes and I can't find the bug. I want to access this blade when I click on the nav link:

                    <x-nav-link :href="route" :active="request()->routeIs">
                        {{ __('Admin') }}
                    </x-nav-link>

I have the folders in views that's named zing and inside I have one more folder that's named admin and I want to access the create route from that folder:

Here it's the web.php:

Route::resource(', [\App\Http\Controllers\AdminController::class])
    ->middleware(['auth']);

What am I doing wrong?

0 likes
8 replies
kokoshneta's avatar

You haven’t properly named your route resource. Resource controllers won’t automagically create nested route names just because there’s a slash in the URL – you have to be specific about that:

Route::prefix('zing')->name('zing.')->group(function() {
	Route::resource('admin', [\App\Http\Controllers\AdminController::class])
    	->middleware(['auth']);
});
1 like
kokoshneta's avatar

@vajricaaaa Yes, that works. If it’s not working for you, your problem is somewhere else in your code. As Michal says, check your routes list to see what your routes are actually named, then go from there.

1 like

Please or to participate in this conversation.