From e8c3b370e12e0ad34480fc659fa915a6e0e11729 Mon Sep 17 00:00:00 2001 From: Michael Slowik Date: Fri, 22 Nov 2019 17:43:31 -0300 Subject: [PATCH] Save user model only while is dirty --- src/FirebaseAuthenticable.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/FirebaseAuthenticable.php b/src/FirebaseAuthenticable.php index c451c63..c8bdb3c 100644 --- a/src/FirebaseAuthenticable.php +++ b/src/FirebaseAuthenticable.php @@ -39,8 +39,11 @@ public function updateOrCreateUser($id, array $attributes): object { if ($user = $this->find($id)) { $user - ->fill($attributes) - ->save(); + ->fill($attributes); + + if ($user->isDirty()) { + $user->save(); + } return $user; }