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',
},
];
}
}; ?>
@if(session('success'))
{{ session('success') }}
@endif
{{ $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-Aktionen --}}
@if($pr->status === \App\Enums\PressReleaseStatus::Review)
{{ __('Diese PM wartet auf Prüfung.') }}
{{ __('Veröffentlichen') }}
{{ __('Ablehnen') }}
@endif
@if($pr->status === \App\Enums\PressReleaseStatus::Published)
{{ __('Archivieren') }}
@if($pr->hits > 0)
{{ number_format($pr->hits) }} {{ __('Aufrufe') }}
@endif
@endif
{{-- Text --}}
{!! nl2br(e($pr->text)) !!}
{{-- Details --}}
{{ __('Details') }}
- {{ __('Status') }}
- {{ $pr->status->label() }}
- {{ __('Erstellt') }}
- {{ $pr->created_at->format('d.m.Y H:i') }}
@if($pr->published_at)
- {{ __('Veröffentlicht') }}
- {{ $pr->published_at->format('d.m.Y H:i') }}
@endif
- {{ __('Aufrufe') }}
- {{ number_format($pr->hits) }}
@if($pr->keywords)
- {{ __('Stichwörter') }}
- {{ $pr->keywords }}
@endif
@if($pr->backlink_url)
@endif
@if($pr->no_export)
{{ __('Kein Export') }}
@endif
@if($pr->images->isNotEmpty())
{{ __('Bilder') }}
@foreach($pr->images as $image)
{{ basename($image->path) }}
@if($image->is_preview)
{{ __('Preview') }}
@endif
@endforeach
@endif
@if($statusLogs->isNotEmpty())
{{ __('Status-Verlauf') }}
@foreach($statusLogs as $log)
-
@php
$color = match($log->to_status?->value) {
'published' => 'green',
'review' => 'yellow',
'rejected' => 'red',
'archived' => 'blue',
default => 'zinc',
};
@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