mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
refactor auto updateand invoice and estimate send
This commit is contained in:
@ -371,12 +371,6 @@ class InvoicesController extends Controller
|
||||
{
|
||||
$invoice = Invoice::findOrFail($request->id);
|
||||
|
||||
if ($invoice->status == Invoice::STATUS_DRAFT) {
|
||||
$invoice->status = Invoice::STATUS_SENT;
|
||||
$invoice->sent = true;
|
||||
$invoice->save();
|
||||
}
|
||||
|
||||
$data['invoice'] = $invoice->toArray();
|
||||
$userId = $data['invoice']['user_id'];
|
||||
$data['user'] = User::find($userId)->toArray();
|
||||
@ -398,6 +392,12 @@ class InvoicesController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if ($invoice->status == Invoice::STATUS_DRAFT) {
|
||||
$invoice->status = Invoice::STATUS_SENT;
|
||||
$invoice->sent = true;
|
||||
$invoice->save();
|
||||
}
|
||||
|
||||
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
|
||||
|
||||
return response()->json([
|
||||
|
||||
Reference in New Issue
Block a user