I have a route:
Route::get('/{id?}/{post}', 'PostController@show')->name('postshow');
I can paste param {id}
from controller?
public function showPost($id = null, Post $post)
{
$id = $post->id;
return view('post.show', compact('post'));
}
I need when user go to post, I need url of post will be: http://example.com/12345/post-slug
Now I get: http://example.com/post-slug
I know that I can pass id in route: route('postshow', [$post->id, $post]);
But I can't, because in blade I have 1000+ records like this: route('postshow', $post);
And search and edit every blade file I can't.