2023-12-11 11:03:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Livewire;
|
|
|
|
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class RealtimeConnection extends Component
|
|
|
|
{
|
|
|
|
public $checkConnection = false;
|
|
|
|
public $showNotification = false;
|
2023-12-11 11:40:56 +00:00
|
|
|
public $isNotificationEnabled = true;
|
2023-12-11 11:03:32 +00:00
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
return view('livewire.realtime-connection');
|
|
|
|
}
|
|
|
|
public function disable()
|
|
|
|
{
|
|
|
|
auth()->user()->update(['is_notification_realtime_enabled' => false]);
|
|
|
|
$this->showNotification = false;
|
|
|
|
}
|
|
|
|
public function mount() {
|
2023-12-11 11:40:56 +00:00
|
|
|
$this->isNotificationEnabled = auth()->user()->is_notification_realtime_enabled;
|
|
|
|
$this->checkConnection = auth()->user()->id === 0;
|
2023-12-11 11:03:32 +00:00
|
|
|
}
|
|
|
|
}
|