Source: dev.to

Livewire Alert
Let's create a simple Livewire Alert component, to replace a normal conventional alert message. Assuming you are using Laravel Jetstream as well. '', 'message' => '', ]; protected $listeners = [ 'displayAlert' => 'display', ]; public function display($title, $message) { $this->state['title'] = $title; $this->state['message'] = $message; $this->displayingModal = true; } public function render() { return view('livewire.alert'); }} The blade file: {{ $state['title']}} {{ $state['message']}} {{ __('Close')}} Once you have the component configured, you may use and trigger by using emitTo: $this->emitTo('alert', 'displayAlert', 'Greeting', 'Hello World!');
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners