fix dashbord & using FROM_MAIL_ADDRESS issues

This commit is contained in:
raishvaria
2020-01-27 13:43:48 +05:30
parent 22e7e96dfa
commit ca170f5a87
7 changed files with 38 additions and 65 deletions

View File

@ -168,10 +168,6 @@ class EstimatesController extends Controller
$data['user'] = User::find($userId)->toArray();
$data['company'] = Company::find($estimate->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);
if (!$email) {
return response()->json([
@ -179,13 +175,13 @@ class EstimatesController extends Controller
]);
}
if (!$notificationEmail) {
if (!config('mail.from.name')) {
return response()->json([
'error' => 'notification_email_does_not_exist'
'error' => 'from_email_does_not_exist'
]);
}
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
\Mail::to($email)->send(new EstimatePdf($data));
}
$estimate = Estimate::with([
@ -340,10 +336,6 @@ class EstimatesController extends Controller
$data['company'] = Company::find($estimate->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);
if (!$email) {
return response()->json([
@ -351,13 +343,13 @@ class EstimatesController extends Controller
]);
}
if (!$notificationEmail) {
if (!config('mail.from.name')) {
return response()->json([
'error' => 'notification_email_does_not_exist'
'error' => 'from_email_does_not_exist'
]);
}
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
\Mail::to($email)->send(new EstimatePdf($data));
if ($estimate->status == Estimate::STATUS_DRAFT) {
$estimate->status = Estimate::STATUS_SENT;