PHP code example of rdcstarr / superpower-broadcasting
1. Go to this page and download the library: Download rdcstarr/superpower-broadcasting library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rdcstarr / superpower-broadcasting example snippets
use Rdcstarr\SuperpowerBroadcasting\Events\UiEvent;
UiEvent::toModel($user, 'tickets', [
'entity' => 'ticket',
'action' => 'created',
'id' => $ticket->id,
]);
use Livewire\Attributes\Computed;
use Rdcstarr\SuperpowerBroadcasting\Attributes\OnUi;
use App\Models\User;
#[Computed]
#[OnUi('tickets', User::class)]
public function unreadCount(): int
{
return auth()->user()->tickets()->where('is_read', false)->count();
}