fn() => \App\Models\Notification::query() ->orderBy('created_at', 'desc') ->get(), 'isAllowed' => false, 'canEdit' => false, 'currentPubkey' => null, 'currentPleb' => null, ]); on([ 'nostrLoggedIn' => function ($pubkey) { $this->currentPubkey = $pubkey; $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); if ($this->currentPleb->association_status->value < 2) { return $this->js('alert("Du bist hierzu nicht berechtigt.")'); } if (in_array($this->currentPleb->npub, config('einundzwanzig.config.current_board'), true)) { $this->canEdit = true; } $this->isAllowed = true; }, 'nostrLoggedOut' => function () { $this->isAllowed = false; $this->currentPubkey = null; $this->currentPleb = null; }, ]); $save = function () { $this->form->validate(); $this->validate([ 'file' => 'required|file|mimes:pdf|max:1024', ]); $notification = \App\Models\Notification::query() ->orderBy('created_at', 'desc') ->create([ 'einundzwanzig_pleb_id' => $this->currentPleb->id, 'category' => $this->form->category, 'name' => $this->form->name, 'description' => $this->form->description, ]); $notification ->addMedia($this->file->getRealPath()) ->toMediaCollection('pdf'); $this->form->reset(); $this->file = null; $this->news = \App\Models\Notification::query() ->orderBy('created_at', 'desc') ->get(); }; $delete = function($id) { $notification = new WireNotification($this); $notification->confirm([ 'title' => 'Post löschen', 'message' => 'Bist du sicher, dass du diesen Post löschen möchtest?', 'accept' => [ 'label' => 'Ja, löschen', 'method' => 'deleteNow', 'params' => $id, ], ]); }; $deleteNow = function($id) { $notification = \App\Models\Notification::query()->find($id); $notification->delete(); $this->news = \App\Models\Notification::query() ->orderBy('created_at', 'desc') ->get(); }; ?> @volt
@if($isAllowed)

News

Menu
    @foreach(\App\Enums\NewsCategory::selectOptions() as $category)
  • {{ $category['label'] }}
  • @endforeach
@forelse($news as $post)
{{ $post->einundzwanzigPleb->profile->name }}

{{ $post->name }}

{{ $post->description }}

{{ $post->einundzwanzigPleb->profile->name }}
{{ $post->created_at->format('d.m.Y') }}
@if($canEdit) @endif
@empty

Keine News vorhanden.

@endforelse
@if($canEdit)
News anlegen
@error('file') {{ $message }} @enderror
@endif
@else

News

Du bist nicht berechtigt, die News einzusehen.

@endif
@endvolt