Dec 13, 2019
51
Level 1
pass Slug and localization to route
Hi everyone.. I working on a website with two language to show success stories .. the problem start when click read More I get an issue when I pass the param of slug to the route, this is my route in balde :
<a href="{{route('success_details',['slug' => $story->slug,'locale' => App()->getLocale()]) }}" >Read More</a>
in the web.php :
Route::get('success','HomPageController@success')->name('success');
Route::get('success/{slug}','HomPageController@success_details')->name('success_details');
this is the controller
public function success_details($slug)
{
$story = Story::where('id', request()->slug)
->orWhere('slug', request()->slug)
->firstOrFail();
return view('user.stories_details', compact('story'));
}
the error message :
Facade\Ignition\Exceptions\ViewException
Missing required parameters for [Route: success_details] [URI: {locale}/success/{slug}]. (View:
C:\Users\ManOf360\Desktop\success_story\resources\views\user\layouts\header.blade.php)
http://127.0.0.1:8000/en/success/domind-in-the-stone-of-muntinte
and this is the header.blade.php :
<li>
<a href="{{route('success',app()->getLocale())}}">@lang('header.Success Stories')</a>
</li>
help please :)
Please or to participate in this conversation.