setup test event

This commit is contained in:
Andras Bacsai 2023-12-06 10:25:23 +01:00
parent e2578a7dd0
commit 7e4947ba07
4 changed files with 23 additions and 15 deletions

View File

@ -10,17 +10,6 @@ class Dashboard extends Component
{
public $projects = [];
public $servers = [];
public function getListeners()
{
$teamId = auth()->user()->currentTeam()->id;
return [
"echo-private:custom.{$teamId},TestEvent" => 'notifyNewOrder',
];
}
public function notifyNewOrder()
{
$this->emit('success', 'New order received!');
}
public function mount()
{
$this->servers = Server::ownedByCurrentTeam()->get();

View File

@ -6,6 +6,17 @@
class Sponsorship extends Component
{
public function getListeners()
{
$teamId = auth()->user()->currentTeam()->id;
return [
"echo-private:custom.{$teamId},TestEvent" => 'testEvent',
];
}
public function testEvent()
{
$this->emit('success', 'Realtime events configured!');
}
public function disable()
{
auth()->user()->update(['is_notification_sponsorship_enabled' => false]);

View File

@ -45,6 +45,7 @@
<x-version class="fixed left-2 bottom-1" />
<script>
@auth
window.Pusher = Pusher;
window.Echo = new Echo({
broadcaster: 'pusher',
@ -59,6 +60,7 @@
enableLogging: true,
enabledTransports: ['ws', 'wss'],
});
@endauth
let checkHealthInterval = null;
let checkIfIamDeadInterval = null;

View File

@ -39,13 +39,19 @@
use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse;
use Laravel\Fortify\Fortify;
Route::get('/fire', function () {
event(new \App\Events\TestEvent());
return 'fired';
});
if (isDev()) {
Route::get('/dev/compose', Compose::class)->name('dev.compose');
}
Route::get('/api/v1/test/realtime', function () {
if (auth()->user()?->currentTeam()->id !== 0) {
return redirect('/');
}
event(new \App\Events\TestEvent());
return 'Look at your other tab.';
})->middleware('auth');
Route::post('/forgot-password', function (Request $request) {
if (is_transactional_emails_active()) {
$arrayOfRequest = $request->only(Fortify::email());