mivita/app/Mail/MailLog.php
Kevin e9fa749adc Pint: Formatierung des bisherigen Stands, ohne inhaltliche Aenderung
Die Dateien lagen im Arbeitsbaum formatiert und inhaltlich geaendert
zusammen. Dieser Commit enthaelt nur die Pint-Formatierung des alten
Stands, damit die folgenden Commits nur noch Inhalt zeigen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 15:39:17 +00:00

62 lines
1.5 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class MailLog extends Mailable
{
use Queueable, SerializesModels;
protected $channel;
protected $context;
protected $message;
protected $data;
public $subject;
public function __construct($channel, $context, $message, $data)
{
$this->channel = $channel;
$this->context = $context;
$this->message = $message;
$this->data = $data;
$this->subject = 'mivita Log';
}
public function build()
{
$title = 'Log: '.$this->channel.' '.$this->context;
// make Data readable
$this->data = json_encode($this->data, JSON_PRETTY_PRINT);
$content = '';
$content .= "\n";
$content .= 'Channel: '.$this->channel."\n";
$content .= 'Context: '.$this->context."\n";
if (\Auth::check()) {
$content .= 'From User: '.\Auth::user()->id.' | '.\Auth::user()->email."\n";
}
$content .= "\n";
$content .= 'Message: '.$this->message."\n";
$content .= "\n";
$content .= 'Data: '.$this->data."\n";
$content .= "\n";
$content .= "\n";
$content .= 'Time: '.now()->format('d.m.Y H:i');
$content .= "\n";
$content .= request()->header('User-Agent');
return $this->view('emails.sys')->with([
'title' => $title,
'content' => $content,
]);
}
}