mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
refactor auto updateand invoice and estimate send
This commit is contained in:
@ -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([
|
||||
|
||||
Reference in New Issue
Block a user