wip: broadcast

This commit is contained in:
Andras Bacsai
2023-12-04 20:47:32 +01:00
parent 17deff4d86
commit 42ee4ca032
22 changed files with 142 additions and 103 deletions

View File

@@ -1,27 +0,0 @@
<?php
namespace App\Providers;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ApplicationDeploymentFinished implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct()
{
}
public function broadcastOn(): array
{
return [
new Channel('custom-channel'),
];
}
}

View File

@@ -8,31 +8,15 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvi
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
// Registered::class => [
// SendEmailVerificationNotification::class,
// ],
ApplicationDeploymentFinished::class => [
SendDeploymentNotification::class,
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;

View File

@@ -1,28 +0,0 @@
<?php
namespace App\Providers;
use App\Providers\ApplicationDeploymentFinished;
use Illuminate\Contracts\Events\ShouldHandleEventsAfterCommit;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class SendDeploymentNotification implements ShouldQueue, ShouldHandleEventsAfterCommit
{
use InteractsWithQueue;
/**
* Create the event listener.
*/
public function __construct()
{
//
}
/**
* Handle the event.
*/
public function handle(ApplicationDeploymentFinished $event): void
{
ray('SendDeploymentNotification');
}
}