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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners