Skip to content

Instantly share code, notes, and snippets.

@monish-khatri
Created September 5, 2023 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monish-khatri/dbdf5b2a8db1e701784a84a6e73e2179 to your computer and use it in GitHub Desktop.
Save monish-khatri/dbdf5b2a8db1e701784a84a6e73e2179 to your computer and use it in GitHub Desktop.
<?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