after grouping urls with prefix in web.php I have created language switcher like this
Route::redirect('/','/ge');
Route::group(['prefix' => '{language}'],function (){
Route::get('/', function () {
return view('welcome');
});
});
I tested it and it was working fine. now I need to add links ( language switcher) but after I do this I receive an exception and an error.
Symfony\Component\Routing\Exception\RouteNotFoundException
Route [] not defined. (View: /Users/mac/laravel/Template/resources/views/welcome.blade.php)
throw new RouteNotFoundException("Route [{$name}] not defined.");
my list looks like that
<div class="languages">
<ul>
<li><a href="{{route(\Illuminate\Support\Facades\Route::getCurrentRoute(),'ge')}}">GE</a></li>
<li><a href="{{route(\Illuminate\Support\Facades\Route::getCurrentRoute(),'en')}}">EN</a></li>
<li><a href="{{route(\Illuminate\Support\Facades\Route::getCurrentRoute(),'ru')}}">RU </a></li>
</ul>
</div>
I even used \Illuminate\Support\Facades\Request::route()->getName() instead of route(\Illuminate\Support\Facades\Route::getCurrentRoute() but looks like problem is something different. Route::currentRouteName() is not working as well