refactor: Relocate real-time mutation broadcasts to model hooks
This commit is contained in:
@@ -92,6 +92,15 @@ class Mutation extends Model
|
||||
]);
|
||||
}
|
||||
broadcast(new MessageSent($dynamicMsg));
|
||||
|
||||
// Trigger the real-time creation broadcast dynamically
|
||||
broadcast(new \App\Events\MutationCreated($mutation));
|
||||
});
|
||||
|
||||
static::updated(function (Mutation $mutation) {
|
||||
if ($mutation->wasChanged('status')) {
|
||||
broadcast(new \App\Events\MutationUpdated($mutation));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user