vendredi 23 juillet 2021

Save an array with laravel?

I have an array. Now I save it to the database:

public function store(Request $request)
{
    $link = ['http://localhost.loca/image/img-1627019138.jpg'];

    $product = new Product();
    $product->link = $link;
    $product->save();
}

And it gives such error:

Array to string conversion

I want to save it to the database in the form:

['http://localhost.loca/image/img-1627019138.jpg']

Because it has a lot of links so it has to be saved as an array in the field.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3BAbMIh
via IFTTT

Aucun commentaire:

Enregistrer un commentaire