Anvil
Anvil - The mobile companion for Laravel Forge. Available now. Download for iOS

Eloquent’s fresh() and refresh() Are Not the Same

  • Laravel
  • Eloquent

refresh() reloads the model in-place from the database.

fresh() returns a new instance.

1$user->name = 'John';
2$user->refresh(); // Will discard changes and reload
3 
4$newUser = $user->fresh(); // $user still has changes, $newUser doesn't

Subtle difference, big impact.