From f6dafb204a523bfcdaad2185b13bcc090b8b463b Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Wed, 18 Jan 2023 23:44:55 +0100 Subject: [PATCH] laravel echo --- app/Events/PlebLoggedInEvent.php | 2 +- app/Http/Livewire/LaravelEcho.php | 11 ++++++++++- app/Listeners/AddLoginReputation.php | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Events/PlebLoggedInEvent.php b/app/Events/PlebLoggedInEvent.php index 737a9459..143f0b77 100644 --- a/app/Events/PlebLoggedInEvent.php +++ b/app/Events/PlebLoggedInEvent.php @@ -16,7 +16,7 @@ class PlebLoggedInEvent implements ShouldBroadcast * Create a new event instance. * @return void */ - public function __construct(public string $name) + public function __construct(public string $name, public string $img) { // } diff --git a/app/Http/Livewire/LaravelEcho.php b/app/Http/Livewire/LaravelEcho.php index 20866340..acb0e61b 100644 --- a/app/Http/Livewire/LaravelEcho.php +++ b/app/Http/Livewire/LaravelEcho.php @@ -14,7 +14,16 @@ class LaravelEcho extends Component public function plebLoggedIn($data) { $this->notification() - ->success(title: 'Pleb alert!', description: $data['name'].' logged in'); + ->confirm([ + 'img' => $data['img'], + 'title' => 'Pleb alert!', + 'description' => $data['name'].' logged in', + 'icon' => 'bell', + 'acceptLabel' => '', + 'rejectLabel' => '', + 'iconColor' => 'primary', + 'timeout' => 60000, + ]); } public function render() diff --git a/app/Listeners/AddLoginReputation.php b/app/Listeners/AddLoginReputation.php index 6798772d..5dbcd79f 100644 --- a/app/Listeners/AddLoginReputation.php +++ b/app/Listeners/AddLoginReputation.php @@ -26,6 +26,6 @@ class AddLoginReputation public function handle($event) { $event->user->givePoint(new LoggedIn($event->user)); - event(new PlebLoggedInEvent($event->user->name)); + event(new PlebLoggedInEvent($event->user->name, $event->user->profile_photo_url)); } }