notifications()->isNotEmpty() ? Yaml::decode($this->notifications()->value()) : []; $newNotification = null; foreach ($notifications as $key => $notification) { $notifications[$key]['isread'] = true; } $updatedUser = $this->update([ 'notifications' => Yaml::encode(array_values($notifications)) ]); return Yaml::decode($updatedUser->notifications()->value()); } catch (\Throwable $th) { throw new Exception("Error updating notifications: " . $th->getMessage() . ' line ' . $th->getLine(), 1); } };