I have a link that goes to loads a new Vue component where there should be content of a clicked forum post. Now I pass two parameters in url to Laravel and I only get blank page. I tried with one parameter and it works with no problem.
I already tried with optional parameters, but doesn't help. As mentioned I tried with one parameter and it work fine, but I need it to work with two.
Vue router link
<router-link :to="`/post/${post.postHash}/${post.title.replace(/\s+/g, '_')}`">
That creates url like this: http://mypage.test/post/news/post1 Laravel code
Route::get('/post/{category}/{title}','ForumController@show');
And function from ForumController
public function show(Request $request,$postHash,$title)
{
$title = str_replace('_', ' ', $title);
$post = ForumPost::where('title',$title)->first();
$post->user=$post->user;
$post->forumTheme;
return json_encode($post);
}
Code from ForumController works as I tested it with only one parameter, but with two parameters it doesn't even execute.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire