Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Array to string conversion Error on Laravel 8

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading