1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/app/Ninja/Intents/EmailInvoiceIntent.php

28 lines
669 B
PHP
Raw Normal View History

2016-08-09 22:06:24 +02:00
<?php namespace App\Ninja\Intents;
use Auth;
use Exception;
use App\Models\EntityModel;
use App\Models\Invoice;
class EmailInvoiceIntent extends InvoiceIntent
{
public function process()
{
$invoice = $this->invoice();
if ( ! Auth::user()->can('edit', $invoice)) {
throw new Exception(trans('texts.not_allowed'));
}
$contactMailer = app('App\Ninja\Mailers\ContactMailer');
$contactMailer->sendInvoice($invoice);
$message = trans('texts.bot_emailed_' . $invoice->getEntityType());
return view('bots.skype.message', [
'message' => $message
])->render();
}
}