mercredi 27 décembre 2017

laravel savemany with pivot

Is there a way to save many objects with pivot data? I have a many-to-many polymorphic relation and would like to do the following:

$attribute->texts()->saveMany([$value1, $value2], ['article_id' => 1]);

I already can do

$attribute->texts()->save($value1, ['article_id' => 1]);

Is there a way to achieve this with laravels eloquent?



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

Aucun commentaire:

Enregistrer un commentaire