Skip to content

[13.x] Add insertOrIgnoreReturning() to the Eloquent builder passthru - #61393

Merged
taylorotwell merged 2 commits into
laravel:13.xfrom
xurshudyan:eloquent-insert-or-ignore-returning
Sep 1, 2026
Merged

taylorotwell merged 2 commits into
laravel:13.xfrom
xurshudyan:eloquent-insert-or-ignore-returning

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

insertOrIgnoreReturning() was added to the query builder in #59025 but never added to the Eloquent builder's $passthru, so on a model the returned rows are lost:

$new = Tag::insertOrIgnoreReturning([
    ['name' => 'php'],
    ['name' => 'laravel'],
], ['id', 'name']);

$new->pluck('id');
// today: runs "select id from tags" and returns every tag in the table
// expected: the ids that were just inserted

The insert itself works, only the return value is wrong. DB::table('tags') is unaffected.

@taylorotwell
taylorotwell merged commit af1e082 into laravel:13.x Sep 1, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants