feat(api): organisation email branding and shared mail layout

- Add email branding columns to organisations table (logo, color, reply-to, sender name, footer)
- Create MailBrandingService for resolving per-org branding with defaults
- Create CrewliMailable abstract base class with branded from/reply-to
- Create shared Blade layout (mail.layouts.crewli) with inline CSS
- Refactor Registration*Mail and InvitationMail to extend CrewliMailable
- Add config/crewli.php for platform-wide defaults (portal_url, app_url, logo)
- Add dev-only /mail-preview/{type} route for browser email previewing
- Update Organisation model, resource, and form requests with branding fields

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 00:44:34 +02:00
parent de8ebf724b
commit ec4ba8733d
21 changed files with 739 additions and 60 deletions

View File

@@ -6,23 +6,22 @@ namespace App\Mail;
use App\Models\Event;
use App\Models\Person;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
final class RegistrationRejectedMail extends Mailable implements ShouldQueue
final class RegistrationRejectedMail extends CrewliMailable
{
use Queueable;
use SerializesModels;
public Person $person;
public Event $event;
public ?string $reason;
public function __construct(
public readonly Person $person,
public readonly Event $event,
public readonly ?string $reason = null,
) {}
public function __construct(Person $person, Event $event, ?string $reason = null)
{
parent::__construct($event->organisation);
$this->person = $person;
$this->event = $event;
$this->reason = $reason;
}
public function envelope(): Envelope
{
@@ -33,11 +32,13 @@ final class RegistrationRejectedMail extends Mailable implements ShouldQueue
public function content(): Content
{
$this->buildBranding();
return new Content(
markdown: 'emails.registration-rejected',
view: 'mail.registration-rejected',
with: [
'personName' => $this->person->first_name,
'eventName' => $this->event->name,
'person' => $this->person,
'event' => $this->event,
'reason' => $this->reason,
],
);