Attendize/app/Mailers/OrderMailer.php

45 lines
1.1 KiB
PHP
Raw Normal View History

2016-03-05 00:18:10 +00:00
<?php
2016-06-09 12:19:53 +00:00
namespace App\Mailers;
2016-02-29 15:59:36 +00:00
use App\Models\Order;
use Log;
use Mail;
2016-02-29 15:59:36 +00:00
class OrderMailer
2016-03-05 00:18:10 +00:00
{
public function sendOrderNotification(Order $order)
{
$data = [
'order' => $order
];
Mail::send('Emails.OrderNotification', $data, function($message) use ($order) {
$message->to($order->account->email);
$message->subject('New order received on the event '.$order->event->title.' ['.$order->order_reference.']');
});
2016-02-29 15:59:36 +00:00
}
2016-03-05 00:18:10 +00:00
public function sendOrderTickets($order) {
2016-03-05 00:18:10 +00:00
Log::info("Sending ticket to: ".$order->email);
2016-03-05 00:18:10 +00:00
$data = [
'order' => $order,
];
Mail::send('Mailers.TicketMailer.SendOrderTickets', $data, function($message) use ($order) {
$message->to($order->email);
$message->subject('Your tickets for the event '.$order->event->title);
$file_name = $order->order_reference;
$file_path = public_path(config('attendize.event_pdf_tickets_path')).'/'.$file_name.'.pdf';
$message->attach($file_path);
});
2016-03-05 00:18:10 +00:00
2016-02-29 15:59:36 +00:00
}
2016-02-29 15:59:36 +00:00
}