i have a very simple route code
Route::get("/{id}",function($id){
return view("post.posts",$id);});
and a simple code in the view:
<div><h1> hello .{{$id}} </h1></div>
but i get an exception: ErrorException in Factory.php line 167:array_merge(): Argument #2 is not an array
You need to pass array
to your view, so instead of
Route::get("/{id}",function($id) {
return view("post.posts",$id);
});
where you just pass string, you should use:
Route::get("/{id}",function($id) {
return view("post.posts", ['id' => $id]);
});
or alternatively:
Route::get("/{id}",function($id) {
return view("post.posts", compact('id'));
});