lundi 30 mai 2016

Laravel 5.2 insert an array at once and update if exists

I'm trying to insert an array at once and i also want to update if exists. But i get this error.

$jobs = array();

//Iterate over the extracted links and display their URLs
foreach ($links as $link){

        $data = get_job_info($link);

        $jobs[] = [
            'title' => $data['title'],
            'full_desc' => $data['desc'],
            'to_date' => $data['date'],
            'ad_type' => 'fb'
        ];

    }
}

DB::table('customer_position')->insert($jobs);



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1smJi0n
via IFTTT

Aucun commentaire:

Enregistrer un commentaire