users()->filter(function($user) use ($project) { if ($user === $this || $user->projects()->isEmpty()) { return false; } throw new Exception(json_encode($user->name()), 1); $projects = $user->projects(); if ($projects && ($user->role() == 'admin' || $projects->has($project))) { return false; } return false; }); // $recipients = page($projectUri)->managers()->toUsers()->not($this); if (!$recipients) return; $notificationData['isRead']; foreach ($recipients as $otherUser) { try { $notifications = $otherUser->notifications()->isNotEmpty() ? Yaml::decode($otherUser->notifications()->value()) : []; $notifications[] = $notificationData; $otherUser->update([ 'notifications' => $notifications ]); } catch (\Throwable $th) { throw new Exception("Error updating notifications: " . $th->getMessage() . ' line ' . $th->getLine(), 1); } } };