diff --git a/src/Http/Controllers/DispatchEventFromAppController.php b/src/Http/Controllers/DispatchEventFromAppController.php index 2ae7bb9..0f467f1 100644 --- a/src/Http/Controllers/DispatchEventFromAppController.php +++ b/src/Http/Controllers/DispatchEventFromAppController.php @@ -9,10 +9,13 @@ class DispatchEventFromAppController public function __invoke(Request $request) { $event = $request->get('event'); - if (class_exists($event)) { - $event = new $event(...$request->get('payload', [])); + $payload = $request->get('payload', []); + if (class_exists($event)) { + $event = new $event(...$payload); event($event); + } else { + event($event, $payload); } return response()->json([