antriver/laravel-simple-message-trait

5.8.15 2019-05-06 13:53 UTC

This package is auto-updated.

Last update: 2024-04-07 01:06:09 UTC


README

Laravel provides a SimpleMessage class for mail representation of notifications (https://github.com/laravel/framework/blob/5.8/src/Illuminate/Notifications/Messages/SimpleMessage.php) but sometimes you want to use this nice interface on a regular Mailable instance. This package is simply a copy and paste of the SimpleMessage class but as a trait instead of a class.

Install

composer require antriver/laravel-simple-message-trait

Example

<?php

namespace MySite\Mail;

use Antriver\LaravelSimpleMessageTrait\SimpleMessageTrait;
use Illuminate\Mail\Mailable;

abstract class MyCoolMailable extends Mailable
{
    use SimpleMessageTrait;

    // ...
}

Notes

The with($line) method has been removed from the trait because that conflicts with the with($key, $value = null) method on Mailable. Instead you can use line($line) which does the same thing.