Veröffentlichte PMs zeigten im Backend nur den Status-Badge, ohne Weg zur öffentlichen Seite. Im Seitenkopf stehen jetzt Direktlinks — bei Portal::Both einer je Portal (QA-Befund 07.07.). Die URL-Logik ist als PressRelease::publicPortalLinks() zentralisiert (vorher doppelt in der Published-Mail und fehlerhaft im Nachweis-PDF: dort fehlte das /de/press-release/-Segment, die dokumentierte URL lief ins Leere; bei Both nennt der Nachweis jetzt beide URLs). Edition folgt der PM-Sprache statt hart „de". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\PressRelease;
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class PressReleasePublished extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public string $showUrl;
|
|
|
|
/**
|
|
* Öffentliche Detailseiten je Portal, auf dem die PM erschienen ist
|
|
* (bei Portal::Both beide Spokes).
|
|
*
|
|
* @var list<array{label: string, url: string}>
|
|
*/
|
|
public array $portalLinks;
|
|
|
|
public function __construct(
|
|
public readonly User $user,
|
|
public readonly PressRelease $pressRelease,
|
|
) {
|
|
$this->showUrl = $user->canAccessAdmin()
|
|
? route('admin.press-releases.show', $pressRelease->id)
|
|
: route('me.press-releases.show', $pressRelease->id);
|
|
|
|
$this->portalLinks = $pressRelease->publicPortalLinks();
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: 'Ihre Pressemitteilung wurde veröffentlicht: '.$this->pressRelease->title,
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(view: 'emails.press-release.published');
|
|
}
|
|
}
|