i want to find post by slug also in url .. but the comments must be found by post_id
Controller
public function post($slug,$id)
{
$post = Post::where('slug',$slug)->first();
$comments = Comment::where('post_id',$id)->get();
return view('content.post',compact('post','comments'));
}
Route
Route::get('post/{slug}', 'PagesController@post')->name('post.show');
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/38vZUbs
via IFTTT
Aucun commentaire:
Enregistrer un commentaire