mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-26 05:23:19 +00:00
🗑️ Remove election-related blade files no longer in use
This commit is contained in:
51
app/Livewire/EinundzwanzigFeed/Index.php
Normal file
51
app/Livewire/EinundzwanzigFeed/Index.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\EinundzwanzigFeed;
|
||||
|
||||
use App\Models\Event;
|
||||
use Livewire\Component;
|
||||
|
||||
final class Index extends Component
|
||||
{
|
||||
public array $events = [];
|
||||
|
||||
public bool $newEvents = false;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->events = Event::query()
|
||||
->where('type', 'root')
|
||||
->orderBy('created_at', 'desc')
|
||||
->with([
|
||||
'renderedEvent',
|
||||
])
|
||||
->get()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function hydrate(): void
|
||||
{
|
||||
if ($this->newEvents) {
|
||||
$this->loadMore();
|
||||
}
|
||||
}
|
||||
|
||||
#[Rule('echo:events,.newEvents')]
|
||||
public function updated(): void
|
||||
{
|
||||
$this->newEvents = true;
|
||||
}
|
||||
|
||||
public function loadMore(): void
|
||||
{
|
||||
$this->newEvents = false;
|
||||
$this->events = Event::query()
|
||||
->where('type', 'root')
|
||||
->orderBy('created_at', 'desc')
|
||||
->with([
|
||||
'renderedEvent',
|
||||
])
|
||||
->get()
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user