This commit is contained in:
Andras Bacsai
2023-12-05 11:17:52 +01:00
parent 02989678be
commit ce49f26c53
11 changed files with 107 additions and 65 deletions

26
app/Events/TestEvent.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace App\Events;
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 TestEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct()
{
}
public function broadcastOn(): array
{
return [
new Channel('public'),
];
}
}

View File

@@ -10,6 +10,12 @@ class Dashboard extends Component
{
public $projects = [];
public $servers = [];
protected $listeners = ['echo:public,TestEvent' => 'notifyNewOrder'];
public function notifyNewOrder()
{
$this->emit('success', 'New order received!');
}
public function mount()
{
$this->servers = Server::ownedByCurrentTeam()->get();