diff --git a/app/Http/Controllers/EstimatesController.php b/app/Http/Controllers/EstimatesController.php index 790502d1..706a50a1 100644 --- a/app/Http/Controllers/EstimatesController.php +++ b/app/Http/Controllers/EstimatesController.php @@ -328,13 +328,13 @@ class EstimatesController extends Controller ]); } + \Mail::to($email)->send(new EstimatePdf($data, $notificationEmail)); + if ($estimate->status == Estimate::STATUS_DRAFT) { $estimate->status = Estimate::STATUS_SENT; $estimate->save(); } - \Mail::to($email)->send(new EstimatePdf($data, $notificationEmail)); - return response()->json([ 'success' => true ]); diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index 54a8d764..13415b36 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -392,13 +392,14 @@ class InvoicesController extends Controller ]); } + \Mail::to($email)->send(new invoicePdf($data, $notificationEmail)); + 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([ 'success' => true