Articles Snippets Projects

Save Eloquent Collection at once using the push() method

$user = User::find(1);
$user->name = 'new name';
$user->team->name = $user->name.'\'s team';

// Instead of saving all relationships separately
❌ $user->save();
❌ $user->team->save();

// You can save all relationships in single line
βœ… $user->push();