From a72b422e158f7b21fc8eed236afa855ea71dad3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= Date: Thu, 25 Jun 2020 00:48:15 +0300 Subject: [PATCH] user update fixed --- app/Models/Auth/User.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Models/Auth/User.php b/app/Models/Auth/User.php index 99f55e43c..759dc6367 100644 --- a/app/Models/Auth/User.php +++ b/app/Models/Auth/User.php @@ -57,6 +57,10 @@ class User extends Authenticatable static::retrieved(function($model) { $model->setCompanyIds(); }); + + static::saving(function($model) { + $model->unsetCompanyIds(); + }); } public function companies() @@ -194,4 +198,9 @@ class User extends Authenticatable $this->setAttribute('company_ids', $company_ids); } + + public function unsetCompanyIds() + { + $this->offsetUnset('company_ids'); + } }