I’m learning laravel and when I try the following syntax in route web.php, I get an error Array to string conversion.
Route::get('/product', function() {
$name = 'Batman';
return view('product'.[
'name' => $name
]);
});
Results into:
Array to string conversion
http://127.0.0.1:8000/product
I tried to use implode and failed.
>Solution :
For all commenting, just answer the damn question and stop close voting new-comers.
You are calling the view function with arguments using a dot (.) where it should be a comma (,), as in:
view('product', []); where you used view('product'. []); which means concatenation.