web push notifications
This commit is contained in:
@@ -11,6 +11,8 @@ use App\Models\ReadCursor;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use App\Notifications\NewActivityNotification;
|
||||
|
||||
class ActivityService
|
||||
{
|
||||
/**
|
||||
@@ -54,6 +56,8 @@ class ActivityService
|
||||
'subject_type' => $subject ? get_class($subject) : null,
|
||||
]);
|
||||
|
||||
$this->notify($message);
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -70,6 +74,21 @@ class ActivityService
|
||||
return $mutation;
|
||||
}
|
||||
|
||||
public function notify(Message $message)
|
||||
{
|
||||
$dynamic = $message->chat->chatable;
|
||||
|
||||
if ($dynamic instanceof Dynamic) {
|
||||
$participants = $dynamic->participants;
|
||||
|
||||
foreach ($participants as $participant) {
|
||||
if ($message->user_id !== $participant->id) {
|
||||
$participant->notify(new NewActivityNotification($message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all activities for a given entity.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user