'', 'name' => '', 'description' => '', ]; public $file; public bool $isAllowed = false; public bool $canEdit = false; public ?int $confirmDeleteId = null; public function mount(): void { if (NostrAuth::check()) { $currentPubkey = NostrAuth::pubkey(); $currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $currentPubkey)->first(); if ( $currentPleb && $currentPleb->association_status->value > 1 && $currentPleb->paymentEvents()->where('year', date('Y'))->where('paid', true)->exists() ) { $this->isAllowed = true; } if ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'))) { $this->canEdit = true; } $this->news = \App\Models\Notification::query() ->with(['einundzwanzigPleb.profile']) ->latest() ->get(); } } public function save(): void { $this->validate([ 'file' => 'required|file|mimes:pdf', 'form.category' => 'required|string|in:'.implode(',', NewsCategory::values()), 'form.name' => 'required|string|max:255', 'form.description' => 'nullable|string', ]); $currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', NostrAuth::pubkey())->first(); $news = Notification::query()->create([ 'name' => $this->form['name'], 'description' => $this->form['description'] ?? null, 'category' => $this->form['category'], 'einundzwanzig_pleb_id' => $currentPleb->id, ]); if ($this->file) { $news ->addMedia($this->file) ->toMediaCollection('pdf'); } $this->reset(['form', 'file']); $this->news = \App\Models\Notification::query() ->with(['einundzwanzigPleb.profile']) ->latest() ->get(); } public function confirmDelete(int $id): void { $this->confirmDeleteId = $id; } public function delete(): void { $news = Notification::query()->findOrFail($this->confirmDeleteId); $news->delete(); $this->news = \App\Models\Notification::query() ->with(['einundzwanzigPleb.profile']) ->latest() ->get(); } public function removeFile(): void { $this->file->delete(); $this->file = null; } }; ?>
@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') }}
Öffnen @if($canEdit) Löschen
News löschen? Du bist dabei, diese News zu löschen.
Diese Aktion kann nicht rückgängig gemacht werden.
Abbrechen Löschen
@endif
@empty

Keine News vorhanden.

@endforelse
@if($canEdit)
News anlegen
@error('file') {{ $message }} @enderror
@if ($file) @endif
Kategorie @foreach(\App\Enums\NewsCategory::selectOptions() as $category) @endforeach
Titel
Beschreibung optional
Hinzufügen
@endif
@else
Zugriff auf News nicht möglich

Um die News einzusehen, benötigst du:

  • Einen Vereinsstatus von mindestens 2 (Aktives Mitglied)
  • Eine bezahlte Mitgliedschaft für das aktuelle Jahr ({{ date('Y') }})

@if(!NostrAuth::check()) Bitte melde dich zunächst mit Nostr an. @else Bitte kontaktiere den Vorstand, wenn du denkst, dass du berechtigt sein solltest. @endif

@endif