false]); state(['currentPubkey' => null]); state(['elections' => []]); mount(function () { $this->elections = \App\Models\Election::query() ->get() ->toArray(); }); on([ 'nostrLoggedOut' => function () { $this->isAllowed = false; $this->currentPubkey = null; $this->currentPleb = null; }, ]); on([ 'nostrLoggedIn' => function ($pubkey) { $this->currentPubkey = $pubkey; $this->currentPleb = \App\Models\EinundzwanzigPleb::query() ->where('pubkey', $pubkey)->first(); if ($this->currentPubkey !== '0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033') { return $this->js('alert("Du bist nicht berechtigt, Wahlen zu bearbeiten.")'); } $this->isAllowed = true; }, ]); $saveElection = function ($index) { $election = $this->elections[$index]; $electionModel = \App\Models\Election::find($election['id']); $electionModel->candidates = $election['candidates']; $electionModel->save(); }; ?> @volt
@foreach($elections as $election)
{{ $election['year'] }}
@endforeach
@endvolt