diff --git a/src/Listeners/User.php b/src/Listeners/User.php index 1cd4a9b..706e66c 100644 --- a/src/Listeners/User.php +++ b/src/Listeners/User.php @@ -27,9 +27,16 @@ protected function data($event): array ]; } + $name = $event->user->id; + if (method_exists($event->user, 'name')) { + $name = $event->user->name(); + } elseif ($event->user->name) { + $name = $event->user->name; + } + return [ 'id' => $event->user->id, - 'name' => $event->user->name(), + 'name' => $name, ]; }