Skip to content

Commit 773abc7

Browse files
committed
formatting
1 parent 766a576 commit 773abc7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

queries.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -837,20 +837,20 @@ You may insert several records at once by passing an array of arrays. Each array
837837
['email' => '[email protected]', 'votes' => 0],
838838
]);
839839

840-
The `insertOrIgnore` method will ignore errors while inserting records into the database:
840+
The `insertOrIgnore` method will ignore errors while inserting records into the database. When using this method, you should be aware that duplicate record errors will be ignored and other types of errors may also be ignored depending on the database engine. For example, `insertOrIgnore` will [bypass MySQL's strict mode](https://dev.mysql.com/doc/refman/en/sql-mode.html#ignore-effect-on-execution):
841841

842842
DB::table('users')->insertOrIgnore([
843843
['id' => 1, 'email' => '[email protected]'],
844844
['id' => 2, 'email' => '[email protected]'],
845845
]);
846846

847-
> {note} `insertOrIgnore` will ignore duplicate records and also may ignore other types of errors depending on the database engine. For example, `insertOrIgnore` will [bypass MySQL's strict mode](https://dev.mysql.com/doc/refman/en/sql-mode.html#ignore-effect-on-execution).
848-
849-
The `insertUsing` method will insert new records into the table using a subquery. In the example below, we want to copy the users to a table before pruning.
847+
The `insertUsing` method will insert new records into the table while using a subquery to determine the data that should be inserted:
850848

851849
DB::table('pruned_users')->insertUsing([
852850
'id', 'name', 'email', 'email_verified_at'
853-
], DB::table('users')->select('id', 'name', 'email', 'email_verified_at')->where('updated_at', '<=', now()->subMonth()));
851+
], DB::table('users')->select(
852+
'id', 'name', 'email', 'email_verified_at'
853+
)->where('updated_at', '<=', now()->subMonth()));
854854

855855
<a name="auto-incrementing-ids"></a>
856856
#### Auto-Incrementing IDs

0 commit comments

Comments
 (0)