Last active
January 5, 2024 03:52
-
-
Save saeedvir/4c61a61bdd77c6f99aa319f92c96f732 to your computer and use it in GitHub Desktop.
Laravel UpdateOrCreateOrIncrement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
YourModel::updateOrCreate( | |
[ | |
'user_id' => '1', | |
'user_type' => 'admin' | |
], | |
[ | |
'user_id' => '1', | |
'user_type' => 'admin', | |
'value' => DB::raw('value + 1'), | |
] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment