Created
September 5, 2023 06:18
-
-
Save monish-khatri/dbdf5b2a8db1e701784a84a6e73e2179 to your computer and use it in GitHub Desktop.
This file contains 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 | |
use App\Models\User; | |
$updatedUser = User::find(1)->update(['first_name' => 'Monish']); // Output: true/false | |
$updatedUser = tap(User::find(1), function ($user) { | |
$user->update(['first_name' => 'Monish']); | |
}); // Output: User Object with updated value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment