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

تعليقات

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

How to Create Treeview with Bootstrap and jQuery

jQuery Datatables with PHP, MySQL and AJAX Example

How to Add Images to Dropdown List using jQuery