-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use livewire component with polling for alert banner container
- Loading branch information
Showing
6 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Livewire; | ||
|
||
use Illuminate\Contracts\View\View; | ||
use Livewire\Component; | ||
|
||
class AlertBannerContainer extends Component | ||
{ | ||
public array $alertBanners; | ||
|
||
public function mount(): void | ||
{ | ||
$this->alertBanners = []; | ||
$this->pullFromSession(); | ||
} | ||
|
||
public function pullFromSession(): void | ||
{ | ||
$this->alertBanners = array_merge($this->alertBanners, session()->pull('alert-banners', [])); | ||
} | ||
|
||
public function render(): View | ||
{ | ||
return view('livewire.alerts.alert-banner-container'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
resources/views/filament/alerts/alert-banner-container.blade.php
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
resources/views/livewire/alerts/alert-banner-container.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div wire:poll.1s="pullFromSession" id="alert-banner-container" class="flex flex-col gap-4"> | ||
@foreach ($alertBanners as $alertBanner) | ||
@include('livewire.alerts.alert-banner', ['alertBanner' => $alertBanner]) | ||
@endforeach | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters