Initial commit

This commit is contained in:
Ronald Huynen
2026-03-23 21:37:59 +01:00
commit 2547717edb
2193 changed files with 972171 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class UserForcedLogout implements ShouldBroadcastNow
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $userId;
public $guard;
/**
* Create a new event instance.
*/
public function __construct($userId, $guard = 'web')
{
$this->userId = $userId;
$this->guard = $guard;
}
/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('user.logout.' . $this->userId),
];
}
/**
* The event's broadcast name.
*
* @return string
*/
public function broadcastAs()
{
return 'forced-logout';
}
/**
* Get the data to broadcast.
*
* @return array
*/
public function broadcastWith()
{
return [
'user_id' => $this->userId,
'guard' => $this->guard,
// Send translation key instead of translated message so it translates in user's locale
'message_key' => 'For security and maintenance, a system administrator has logged you out of your account. Sorry for this inconvenience and thanks for your patience.',
];
}
}