My controller is:
public function store()
{
$links = array();
$html = new \Htmldom('http://randomsite.org');
foreach($html->find('a') as $a)
{
$links[] = $a->href;
}
}
and i have the database table called result with field:
id
name
url (i want to put the array here)
desc
what I want is multiple records as number links
If I am right. You need the solution to store data into database.
foreach($links as $link)
{
$result= new Result; //here Result is the model name for the table result
$result->id = $link[0]; //id
$event->name = $link[1]; //name
$event->url = $link[2]; //url
$event->desc = $link[3]; //desc
$event->save();
}
Here you loop through each array of items and insert multiple rows in the table