Skip to content

[5.8] Fix insertOrIgnore() and insertUsing() as Eloquent queries#29645

Merged
taylorotwell merged 1 commit into
laravel:5.8from
staudenmeir:eloquent-insert
Aug 20, 2019
Merged

[5.8] Fix insertOrIgnore() and insertUsing() as Eloquent queries#29645
taylorotwell merged 1 commit into
laravel:5.8from
staudenmeir:eloquent-insert

Conversation

@staudenmeir
Copy link
Copy Markdown
Contributor

When being called as an Eloquent query, insertOrIgnore() and insertUsing() return the query builder instead of the actual result (number of affected rows / success):

User::insertOrIgnore(['foo' => 'bar']);

User::insertUsing(['foo'], "select 'bar'");

@taylorotwell taylorotwell merged commit b449e0e into laravel:5.8 Aug 20, 2019
@staudenmeir staudenmeir deleted the eloquent-insert branch August 20, 2019 01:31
@tw99
Copy link
Copy Markdown
Contributor

tw99 commented Aug 21, 2019

@staudenmeir With the addition of insertOrIgnore does that mean Laravel would accept a PR for upsert?

@staudenmeir
Copy link
Copy Markdown
Contributor Author

@tw99 Please ask Taylor about that.

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.

3 participants