mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-01-07 09:30:50 -05:00
28 lines
669 B
PHP
28 lines
669 B
PHP
<?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();
|
|
}
|
|
}
|