Skip to content

Instantly share code, notes, and snippets.

@webinfinita webinfinita/Mailer.php
Last active Aug 29, 2015

Embed
What would you like to do?
Abstract Mailer class for Laravel 5
<?php namespace App\Services\Mailers;
abstract class Mailer {
public function sendTo($user, $subject, $view, $data = [])
{
Mail::queue($view, $data, function($message) use ($user, $subject)
{
$message->to($user->email)->subject($subject);
});
}
}
<?php namespace App\Services\Mailers;
class UserMailer extends Mailer {
public function welcome()
{
$view = 'emails.welcom';
$data = [];
$subject = 'Welcome to App';
return $this->sendTo($user, subject, $view, $data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.