Ad

Missing Required Parameters For [Route: Tender_detail] Locale Laravel

- 1 answer

Got an error after adding localization to my laravel project. Here is my web.php

//Tender
Route::group(['prefix' => '{language}/tender', 'middleware' => ['permission:tender-page']], function() {
    Route::get('/', '[email protected]')->name('tender');
    Route::get('/add', '[email protected]')->name('tender_add');
    Route::get('/{id}', '[email protected]')->name('tender_detail');
});

Here is my error

ErrorException thrown with message:
"Missing required parameters for [Route: tender_detail] [URI: {language}/tender/{id}]. 
(View: /Users/admin/Desktop/dev/medicare/resources/views/layouts/template.blade.php) 
(View: /Users/admin/Desktop/dev/medicare/resources/views/layouts/template.blade.php)"

Here is part of my template.blade.php

<li class="{{ Request::is('tender*') ? 'active' : '' }}">
<a target="_blank" rel="nofollow noreferrer" href="{{ route('tender', ['language' => app()->getLocale()]) }}">
<i class="notika-icon notika-house"></i> {{ __('tender') }} </a>
</li>

Here is route to the tender_detail page

<a target="_blank" rel="nofollow noreferrer" href="{{ route('tender_detail', ['language' => app()->getLocale(), 'id' => 1])}}">ЛОТ 123456-ОК3</a>
Ad

Answer

The problem was in my language changer links.
`

<li class="nav-item">
   <a target="_blank" rel="nofollow noreferrer" href="{{ route(Route::currentRouteName(), 'ru') }}" class="nav-link">RU</a>
 </li>
 <li class="nav-item">
   <a target="_blank" rel="nofollow noreferrer" href="{{ route(Route::currentRouteName(), 'tr') }}" class="nav-link">TR</a>
 </li>

`

when i delete this links, routes start work

Ad
source: stackoverflow.com
Ad