mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 23:01:29 +00:00
27 lines
790 B
PHP
27 lines
790 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Mail\Concerns;
|
|
|
|
/**
|
|
* Adds a configurable, site-wide subject prefix (default "[App Name] ") to
|
|
* mailables, so transactional emails read consistently in users' inboxes.
|
|
*
|
|
* Concrete mailables call `$this->brandedSubject('Welcome')` instead of
|
|
* `$this->subject('Welcome')`. The prefix can be overridden globally via
|
|
* `MAIL_SUBJECT_PREFIX` (see `config/mail.php` -> `brand.subject_prefix`)
|
|
* or disabled per call by passing `prefix: false`.
|
|
*/
|
|
trait HasBrandedSubject
|
|
{
|
|
protected function brandedSubject(string $subject, bool $prefix = true): static
|
|
{
|
|
$prefixValue = $prefix
|
|
? (string) config('mail.brand.subject_prefix', '')
|
|
: '';
|
|
|
|
return $this->subject($prefixValue.$subject);
|
|
}
|
|
}
|