Answer the question
In order to leave comments, you need to log in
Why am I not getting a record from the database in the route?
I am not getting data into a variable $post
.
Here is the route:
Route::get('catalog/{category}/{post}', function ($id) {
$post = DB::table('posts')->find($id);
dd($post);
return view('view-product', compact('post'));
});
Answer the question
In order to leave comments, you need to log in
Maybe it needs to be?
Route::get('catalog/{id}/{id2}', function ($id,$id2) {
dd($id,$id2);
$post = DB::table('posts')->find($id);
return view('view-product', compact('post'));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question