refactor auto updateand invoice and estimate send

This commit is contained in:
jayvirsinh_gohil
2019-11-15 13:39:57 +05:30
parent 917b618ac7
commit 1051b03b00
4 changed files with 17 additions and 12 deletions

View File

@ -306,8 +306,6 @@ class EstimatesController extends Controller
public function sendEstimate(Request $request)
{
$estimate = Estimate::findOrFail($request->id);
$estimate->status = Estimate::STATUS_SENT;
$estimate->save();
$data['estimate'] = $estimate->toArray();
$userId = $data['estimate']['user_id'];
@ -330,6 +328,11 @@ class EstimatesController extends Controller
]);
}
if ($estimate->status == Estimate::STATUS_DRAFT) {
$estimate->status = Estimate::STATUS_SENT;
$estimate->save();
}
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
return response()->json([

View File

@ -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([

View File

@ -12,7 +12,7 @@ class UpdateController extends Controller
{
set_time_limit(600); // 10 minutes
$json = Updater::update($request->installed, $request->version);
$json = Updater::update($request->installed, $request->version, $request->isMinor);
return response()->json($json);
}