updateOrCreate duplicates?

Posted 8 months ago by traversf

Hi All,

I am using the below to process a file that I receive via a cron job across multiple EC2 instances. I need to ensure I don't add the same data twice into the table so I'm using trace_id.

However I've just looked at the table and there are duplicate entries of trace_id? Is updateOrCreate not the right function to use for this?

Appreciate the help

Thanks, Travers

points::updateOrCreate([
                'trace_id'    => $this->trace
            ], [
                'userid' => $this->userid,
                'points'      => $this->points,
                'message'     => $this->msg,
                'year'        => $this->year
          ]);

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.