I believe you must check for the presence of the station_forbidden session key within the Livewire component; the entire DOM does not re-render, only the component itself. Do you attempt to display the flash message outside the component's template?
Jan 21, 2021
3
Level 14
Livewire session?
Can I use LW Flash Messages when I dont create or save records in db? For example, in this case it does not appear to me:
public function deleteStation()
{
$station = Station::find($this->deleteId);
if ( $station->lines()->exists() ) {
session()->flash('station_forbidden', 'Sorry, this station have line');
$this->showDeleteModal = false;
} else {
Station::destroy($this->deleteId);
$this->showDeleteModal = false;
}
}
Please or to participate in this conversation.