I have a dynamic navigation (all names, icons, links, aand all other things comes from table).
But when I tried to use link I get error that Route [soon] not defined
@foreach($categories as $item)
<li class="sidebar-dropdown">
<a class="fw-bold" href="javascript:void(0)"><i class="uil {{ $item->icon }} me-2 d-inline-block"></i>{{ $item->title }}</a>
<div class="sidebar-submenu">
@foreach($item['children'] as $child)
<ul>
<li><a href="{{ route($child->link)}}">{{ $child->title }}</a></li>
</ul>
@endforeach
</div>
</li>
@endforeach
web route code:
Route::prefix(config('admintw.prefix'))->middleware(['auth',
'verified', 'activeUser', 'IpCheckMiddleware'])->group(function () {
Route::get('soon', AppHttpLivewireAdminMiscellaneousComingsoon::class)->name('soon');
});
In the table’s link column there is "soon".
2
Answers
The error message "Route [soon] not defined" means that Laravel is unable to find a named route with the name "soon". In your case, the issue is that the link column in your table is storing the literal string "soon" instead of the route name. To fix this, you need to modify the link column in your table to store the name of the route instead of the literal string.
Assuming that the title of the navigation link is the same as the name of the route, you can modify your code like this:
php artisan tinker
and checkroute('soon')
and if you get an error, that means that routewasn’t processed
try with something simple like