id = $id;
}
public function publish(): void
{
$pr = PressRelease::withoutGlobalScopes()->findOrFail($this->id);
try {
app(PressReleaseService::class)->publish($pr);
} catch (BlacklistViolationException $e) {
session()->flash('error', __('Automatisch abgelehnt: unzulässiges Wort ":word".', ['word' => $e->word]));
Flux::modal('confirm-show-publish')->close();
return;
}
session()->flash('success', __('Pressemitteilung veröffentlicht. Autor wurde benachrichtigt.'));
Flux::modal('confirm-show-publish')->close();
}
public function reject(): void
{
$this->validate([
'rejectReason' => ['required', 'string', 'min:5', 'max:2000'],
]);
$pr = PressRelease::withoutGlobalScopes()->findOrFail($this->id);
app(PressReleaseService::class)->reject($pr, trim($this->rejectReason));
$this->rejectReason = '';
session()->flash('success', __('Pressemitteilung abgelehnt. Autor wurde benachrichtigt.'));
Flux::modal('confirm-show-reject')->close();
}
public function archive(): void
{
$pr = PressRelease::withoutGlobalScopes()->findOrFail($this->id);
app(PressReleaseService::class)->archive($pr);
session()->flash('success', __('Archiviert.'));
Flux::modal('confirm-show-archive')->close();
}
public function with(): array
{
$pr = PressRelease::withoutGlobalScopes()
->with([
'company:id,name,slug',
'category.translations',
'user:id,name',
'images',
'statusLogs.changedBy:id,name',
])
->findOrFail($this->id);
return [
'pr' => $pr,
'statusLogs' => $pr->statusLogs,
'categoryName' => $pr->category?->translations->firstWhere('locale', 'de')?->name
?? $pr->category?->translations->first()?->name
?? '–',
'statusColor' => match ($pr->status->value) {
'published' => 'green',
'review' => 'yellow',
'rejected' => 'red',
'archived' => 'blue',
default => 'zinc',
},
];
}
}; ?>
@php
$statusClass = match ($pr->status->value) {
'published' => 'ok',
'review' => 'warn',
'rejected' => 'err',
default => 'hub',
};
@endphp
@if (session('success'))
{{ session('success') }}
@endif
@if (session('error'))
{{ session('error') }}
@endif
{{-- ============== PAGE HEADER ============== --}}
{{ __('Admin Backend') }}
{{ __('Content · Pressemitteilung') }}
{{ $pr->status->label() }}
{{ strtoupper($pr->language) }}
{{ $pr->portal->label() }}
{{ $pr->title }}
{{ __('Firma') }}:
{{ $pr->company?->name ?? '–' }}
·
{{ __('Kategorie') }}:
{{ $categoryName }}
·
{{ __('Autor') }}:
{{ $pr->user?->name ?? '–' }}
{{ __('Bearbeiten') }}
{{ __('Zurück') }}
{{-- ============== STATUS-WORKFLOW ============== --}}
@if ($pr->status === \App\Enums\PressReleaseStatus::Review)
{{ __('Status-Workflow') }}
{{ __('Wartet auf Prüfung') }}
{{ __('Diese PM wartet auf Prüfung.') }}
{{ __('Veröffentlichen') }}
{{ __('Ablehnen') }}
@endif
@if ($pr->status === \App\Enums\PressReleaseStatus::Published)
{{ __('Status-Workflow') }}
{{ __('Live') }}
@if ($pr->hits > 0)
{{ number_format($pr->hits) }}
{{ __('Aufrufe seit Veröffentlichung') }}
@endif
{{ __('Archivieren') }}
@endif
{{-- ============== TEXT + SIDEBAR ============== --}}
{{ __('Inhalt') }}
{!! $pr->renderedText() !!}
{{-- ============== STATUS-VERLAUF ============== --}}
@if ($statusLogs->isNotEmpty())
{{ __('Status-Verlauf') }}
{{ $statusLogs->count() }} {{ __('Einträge') }}
@foreach ($statusLogs as $log)
-
@php
$logClass = match ($log->to_status?->value) {
'published' => 'ok',
'review' => 'warn',
'rejected' => 'err',
default => 'hub',
};
@endphp
{{ $log->to_status?->label() ?? $log->to_status }}
@if ($log->from_status)
{{ __('von') }} {{ $log->from_status->label() }}
@endif
·
{{ $log->created_at->format('d.m.Y H:i') }}
@if ($log->changedBy)
·
{{ $log->changedBy->name }}
@endif
@if ($log->source !== 'admin')
{{ $log->source }}
@endif
@if ($log->reason)
{{ $log->reason }}
@endif
@endforeach
@endif
@if($pr->status === \App\Enums\PressReleaseStatus::Review)
{{ __('Pressemitteilung veröffentlichen?') }}
{{ __('Die Pressemitteilung wird öffentlich sichtbar und der Autor wird benachrichtigt.') }}
{{ __('Abbrechen') }}
{{ __('Veröffentlichen') }}
{{ __('Pressemitteilung ablehnen?') }}
{{ __('Die Pressemitteilung wird abgelehnt und der Autor wird benachrichtigt. Bitte begründen Sie die Ablehnung.') }}
{{ __('Begründung (an den Autor sichtbar)') }}
{{ __('Abbrechen') }}
{{ __('Ablehnen') }}
@endif
@if($pr->status === \App\Enums\PressReleaseStatus::Published)
{{ __('Pressemitteilung archivieren?') }}
{{ __('Die Pressemitteilung bleibt intern erhalten, wird aber archiviert.') }}
{{ __('Abbrechen') }}
{{ __('Archivieren') }}
@endif