DEV Community

Morcos Gad
Morcos Gad

Posted on


insertOrIgnore to Ignore SQL Errors - Laravel

I found this tip and wanted to share it with you so that you can benefit from it in your next projects, which is if you are not sure that this row exists in the database and want to avoid sending an error message when this row exists here, use insertOrIgnore

Laravel InsertOrIgnore With Eloquent

Enter fullscreen mode Exit fullscreen mode

Laravel InsertOrIgnore Query With Eloquent Model

Enter fullscreen mode Exit fullscreen mode

I hope you benefited and enjoyed this code with him. If you want to dig deeper, visit these sources

Top comments (0)

Super Useful CSS Resources

A collection of 70 hand-picked, web-based tools which are actually useful.
Each will generate pure CSS without the need for JS or any external libraries.