ssquare
773
9
Laravel

Return ID From updateOrInsert Laravel query builder

Posted 3 months ago by ssquare

How to return the id of las updated or Inserted id.

I am using query builder instead of eloquent. How can I return ID from the following example:

DB::table('users')
    ->updateOrInsert(
        ['email' => '[email protected]', 'name' => 'John'],
        ['votes' => '2']
    );

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