How to use updateOrInsert() method in Laravel Query?
updateOrInsert() method is used to update an existing record in the database if matching the condition or create if no matching record exists.
Its return type is Boolean.
Syntax
DB::table(‘blogs’)->updateOrInsert([Conditions],[fields with value]);
Example
DB::table(‘blogs’)->updateOrInsert(
['email' => 'info@bestinterviewquestion.com', 'title' => 'Best Interview Questions'],
['content' => 'Test Content']
);