1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/app/ninja/mailers/ContactMailer.php
Hillel Coren 6999a6501d bug fixes
2014-01-06 20:03:00 +02:00

37 lines
738 B
PHP
Executable File

<?php namespace ninja\mailers;
use Invoice;
use Contact;
use Invitation;
use URL;
use Auth;
use Activity;
class ContactMailer extends Mailer {
public function sendInvoice(Invoice $invoice)
{
$view = 'invoice';
$subject = '';
foreach ($invoice->invitations as $invitation)
{
$invitation->sent_date = \Carbon::now()->toDateTimeString();
$invitation->save();
$data = array('link' => URL::to('view') . '/' . $invitation->invitation_key);
$this->sendTo($invitation->contact->email, $subject, $view, $data);
Activity::emailInvoice($invitation);
}
if (!$invoice->isSent())
{
$invoice->invoice_status_id = INVOICE_STATUS_SENT;
$invoice->save();
}
\Event::fire('invoice.sent', $invoice);
}
}