jeudi 11 octobre 2018

I get duplicate entries with the attach method in Laravel 5. Not sure what the problem is

So I'm trying to attach id's with some meta data to a pivot table in Laravel 5.

For some reason, I get the two inserts where there should be one, and the wrong ID's being inserted the second time round.

I'm not sure if there is something I might be missing here.

This is the code:

$match_values = array(
                    'dataId' => $result->id,
                    'dataMetaId' => $the_meta->id
                );

                $result->campaignDataMeta()->attach($match_values, [
                    'meta_value' => $value
                ]);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire