2017 © Pedro Peláez
 

library mail-sender

Mail block that sends email by template

image

preshetin/mail-sender

Mail block that sends email by template

  • Friday, July 28, 2017
  • by preshetin
  • Repository
  • 0 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

mail-sender

Mail block that sends email by template for Laravel 5.3 / Laraflock Dashboard, (*1)

Install

  1. Require in composer:
composer require preshetin/mail-sender:dev-master
  1. Then register in config/app.php
providers' => [
    ...
    Preshetin\MailSender\MailSenderServiceProvider::class,
];
  1. Run migrations to create mail_logs & mail_templates tables:
php artisan migrate
  1. Add MailableEntity interface & MailSenderTrait trait in any Eloquent model:
use Preshetin\MailSender\MailSenderTrait;
use Preshetin\MailSender\Model\MailableEntity;

class Order extends Model implements MailableEntity
{
    use MailSenderTrait;

    // ...
}
  1. MailableEntity interface will require you to add a couple of methods:

This is where email sends TO:, (*2)

public function getEmail()
{
    return $this->user->email;
}

And getMailTemplateReplacements which gets values for mail template variables:, (*3)

public function getMailTemplateReplacements()
{
    return [
        '[ORDER_ID]' => $this->id,
        '[NAME]'     => $this->user->name,
        ...     
    ];
}

That's it! Now you may insert Blade templates and get mail send functionality!, (*4)

Usage

Add in blade templates:, (*5)

@include('mail-sender::partials.mail', ['mailable_entity' => $order])

Also, you may add to your sidebar:, (*6)

@include('mail-sender::partials.sidebar')

Configuration

You may php artisan vendor:publish config mail-sender.php. There you may ajust a view for emails:, (*7)

'mail_view' => 'emails.your_custom_view',

The Versions

28/07 2017

dev-master

9999999-dev

Mail block that sends email by template

  Sources   Download

The Requires

 

The Development Requires

by Petr Reshetin

27/07 2017

1.1

1.1.0.0

Mail block that sends email by template

  Sources   Download

The Requires

 

The Development Requires

by Petr Reshetin

26/07 2017

1.0

1.0.0.0

Mail block that sends email by template

  Sources   Download

The Requires

 

The Development Requires

by Petr Reshetin