I've code in file navigation-menu.blade.php
@if (auth()->user()->role_id == 2)
<x-jet-nav-link href="{{ route('murid.index') }}" :active="request()->routeIs('murid.index')">
{{ __('Murid') }}
</x-jet-nav-link>
@endif
and my code in routes/web.php
Route::group(['middleware' => 'auth'], function() {
Route::group(['middleware' => 'role:murid', 'prefix' => 'murid', 'as' => 'murid.'], function() {
Route::resource('murid', \App\Http\Controllers\MuridController::class);
});
});
But, i got error Route [murid.index] not defined. From file navigation-menu.blade {{ route('murid.index') }} can't define. i already define in routes/web.php.
What's wrong with my code ?
Anyone can help me ? Thanks
If you have prefix "murid" and resource is "murid", then you must call the route like
href="{{ route('murid.murid.index') }}"
That must fix the issue.