Skip to content

Instantly share code, notes, and snippets.

@mansha99
Created May 13, 2023 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mansha99/7472949676e33b5c0de4c24500d480bc to your computer and use it in GitHub Desktop.
Save mansha99/7472949676e33b5c0de4c24500d480bc to your computer and use it in GitHub Desktop.
A Laravel Livewire component acting as publisher (Generator) of event
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Sender extends Component
{
public function fireTimestampEvent()
{
$this->emit('timestamp-event', 'Timestamp is '.date('h:i:s'));
}
public function render()
{
return view('livewire.sender');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment