laravel echo

This commit is contained in:
Benjamin Takats
2023-01-18 23:44:55 +01:00
parent 107ef6fd81
commit f6dafb204a
3 changed files with 12 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ class PlebLoggedInEvent implements ShouldBroadcast
* Create a new event instance. * Create a new event instance.
* @return void * @return void
*/ */
public function __construct(public string $name) public function __construct(public string $name, public string $img)
{ {
// //
} }

View File

@@ -14,7 +14,16 @@ class LaravelEcho extends Component
public function plebLoggedIn($data) public function plebLoggedIn($data)
{ {
$this->notification() $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() public function render()

View File

@@ -26,6 +26,6 @@ class AddLoginReputation
public function handle($event) public function handle($event)
{ {
$event->user->givePoint(new LoggedIn($event->user)); $event->user->givePoint(new LoggedIn($event->user));
event(new PlebLoggedInEvent($event->user->name)); event(new PlebLoggedInEvent($event->user->name, $event->user->profile_photo_url));
} }
} }