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

تعليقات

المشاركات الشائعة من هذه المدونة

BlueHost Web Hosting Review: Secrets Revealed for Shared Hosting

How to Create Treeview with Bootstrap and jQuery

Submit Form using jQuery AJAX and PHP without Page Refresh