mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
Add name in From field.
This commit is contained in:
@ -168,10 +168,6 @@ class EstimatesController extends Controller
|
|||||||
$data['user'] = User::find($userId)->toArray();
|
$data['user'] = User::find($userId)->toArray();
|
||||||
$data['company'] = Company::find($estimate->company_id);
|
$data['company'] = Company::find($estimate->company_id);
|
||||||
$email = $data['user']['email'];
|
$email = $data['user']['email'];
|
||||||
$notificationEmail = CompanySetting::getSetting(
|
|
||||||
'notification_email',
|
|
||||||
$request->header('company')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$email) {
|
if (!$email) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@ -179,13 +175,7 @@ class EstimatesController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$notificationEmail) {
|
\Mail::to($email)->send(new EstimatePdf($data));
|
||||||
return response()->json([
|
|
||||||
'error' => 'notification_email_does_not_exist'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$estimate = Estimate::with([
|
$estimate = Estimate::with([
|
||||||
@ -340,10 +330,6 @@ class EstimatesController extends Controller
|
|||||||
$data['company'] = Company::find($estimate->company_id);
|
$data['company'] = Company::find($estimate->company_id);
|
||||||
|
|
||||||
$email = $data['user']['email'];
|
$email = $data['user']['email'];
|
||||||
$notificationEmail = CompanySetting::getSetting(
|
|
||||||
'notification_email',
|
|
||||||
$request->header('company')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$email) {
|
if (!$email) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@ -351,13 +337,7 @@ class EstimatesController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$notificationEmail) {
|
\Mail::to($email)->send(new EstimatePdf($data));
|
||||||
return response()->json([
|
|
||||||
'error' => 'notification_email_does_not_exist'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
|
|
||||||
|
|
||||||
if ($estimate->status == Estimate::STATUS_DRAFT) {
|
if ($estimate->status == Estimate::STATUS_DRAFT) {
|
||||||
$estimate->status = Estimate::STATUS_SENT;
|
$estimate->status = Estimate::STATUS_SENT;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ use Crater\Invoice;
|
|||||||
use Crater\InvoiceItem;
|
use Crater\InvoiceItem;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Crater\Item;
|
use Crater\Item;
|
||||||
use Crater\Mail\invoicePdf;
|
use Crater\Mail\InvoicePdf;
|
||||||
use function MongoDB\BSON\toJSON;
|
use function MongoDB\BSON\toJSON;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Crater\User;
|
use Crater\User;
|
||||||
@ -167,11 +167,6 @@ class InvoicesController extends Controller
|
|||||||
$data['user'] = User::find($request->user_id)->toArray();
|
$data['user'] = User::find($request->user_id)->toArray();
|
||||||
$data['company'] = Company::find($invoice->company_id);
|
$data['company'] = Company::find($invoice->company_id);
|
||||||
|
|
||||||
$notificationEmail = CompanySetting::getSetting(
|
|
||||||
'notification_email',
|
|
||||||
$request->header('company')
|
|
||||||
);
|
|
||||||
|
|
||||||
$email = $data['user']['email'];
|
$email = $data['user']['email'];
|
||||||
|
|
||||||
if (!$email) {
|
if (!$email) {
|
||||||
@ -180,13 +175,7 @@ class InvoicesController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$notificationEmail) {
|
\Mail::to($email)->send(new InvoicePdf($data));
|
||||||
return response()->json([
|
|
||||||
'error' => 'notification_email_does_not_exist'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoice = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])->find($invoice->id);
|
$invoice = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])->find($invoice->id);
|
||||||
@ -408,10 +397,6 @@ class InvoicesController extends Controller
|
|||||||
$data['user'] = User::find($userId)->toArray();
|
$data['user'] = User::find($userId)->toArray();
|
||||||
$data['company'] = Company::find($invoice->company_id);
|
$data['company'] = Company::find($invoice->company_id);
|
||||||
$email = $data['user']['email'];
|
$email = $data['user']['email'];
|
||||||
$notificationEmail = CompanySetting::getSetting(
|
|
||||||
'notification_email',
|
|
||||||
$request->header('company')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$email) {
|
if (!$email) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@ -419,13 +404,7 @@ class InvoicesController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$notificationEmail) {
|
\Mail::to($email)->send(new InvoicePdf($data));
|
||||||
return response()->json([
|
|
||||||
'error' => 'notification_email_does_not_exist'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
|
|
||||||
|
|
||||||
if ($invoice->status == Invoice::STATUS_DRAFT) {
|
if ($invoice->status == Invoice::STATUS_DRAFT) {
|
||||||
$invoice->status = Invoice::STATUS_SENT;
|
$invoice->status = Invoice::STATUS_SENT;
|
||||||
|
|||||||
@ -305,10 +305,6 @@ class PaymentController extends Controller
|
|||||||
$data['user'] = User::find($userId)->toArray();
|
$data['user'] = User::find($userId)->toArray();
|
||||||
$data['company'] = Company::find($payment->company_id);
|
$data['company'] = Company::find($payment->company_id);
|
||||||
$email = $data['user']['email'];
|
$email = $data['user']['email'];
|
||||||
$notificationEmail = CompanySetting::getSetting(
|
|
||||||
'notification_email',
|
|
||||||
$request->header('company')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$email) {
|
if (!$email) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@ -316,13 +312,7 @@ class PaymentController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$notificationEmail) {
|
\Mail::to($email)->send(new PaymentPdf($data));
|
||||||
return response()->json([
|
|
||||||
'error' => 'notification_email_does_not_exist'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($email)->send(new PaymentPdf($data, $notificationEmail));
|
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true
|
'success' => true
|
||||||
|
|||||||
@ -12,17 +12,14 @@ class EstimatePdf extends Mailable
|
|||||||
|
|
||||||
public $data = [];
|
public $data = [];
|
||||||
|
|
||||||
public $notificationEmail = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($data, $notificationEmail)
|
public function __construct($data)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->notificationEmail = $notificationEmail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,8 +30,8 @@ class EstimatePdf extends Mailable
|
|||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
$company = $this->data['company']['name'];
|
$company = $this->data['company']['name'];
|
||||||
return $this->from($this->notificationEmail)
|
|
||||||
->subject("Estimate from $company")
|
return $this->subject("Estimate from $company")
|
||||||
->markdown('emails.send.estimate', ['data', $this->data]);
|
->markdown('emails.send.estimate', ['data', $this->data]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,8 @@ class EstimateViewed extends Mailable
|
|||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
$email = $this->data['user']['email'];
|
$email = $this->data['user']['email'];
|
||||||
return $this->from($email)->markdown('emails.viewed.estimate', ['data', $this->data]);
|
$name = $this->data['user']['name'];
|
||||||
|
return $this->from($email, $name)
|
||||||
|
->markdown('emails.viewed.estimate', ['data', $this->data]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,23 +6,20 @@ use Illuminate\Mail\Mailable;
|
|||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
||||||
class invoicePdf extends Mailable
|
class InvoicePdf extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
public $data = [];
|
public $data = [];
|
||||||
|
|
||||||
public $notificationEmail = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($data, $notificationEmail)
|
public function __construct($data)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->notificationEmail = $notificationEmail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,8 +30,8 @@ class invoicePdf extends Mailable
|
|||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
$company = $this->data['company']['name'];
|
$company = $this->data['company']['name'];
|
||||||
return $this->from($this->notificationEmail)
|
|
||||||
->subject("Invoice from $company")
|
return $this->subject("Invoice from $company")
|
||||||
->markdown('emails.send.invoice', ['data', $this->data]);
|
->markdown('emails.send.invoice', ['data', $this->data]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,6 +31,8 @@ class InvoiceViewed extends Mailable
|
|||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
$email = $this->data['user']['email'];
|
$email = $this->data['user']['email'];
|
||||||
return $this->from($email)->markdown('emails.viewed.invoice', ['data', $this->data]);
|
$name = $this->data['user']['name'];
|
||||||
|
return $this->from($email, $name)
|
||||||
|
->markdown('emails.viewed.invoice', ['data', $this->data]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,17 +13,14 @@ class PaymentPdf extends Mailable
|
|||||||
|
|
||||||
public $data = [];
|
public $data = [];
|
||||||
|
|
||||||
public $notificationEmail = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($data, $notificationEmail)
|
public function __construct($data)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->notificationEmail = $notificationEmail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,8 +31,8 @@ class PaymentPdf extends Mailable
|
|||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
$company = $this->data['company']['name'];
|
$company = $this->data['company']['name'];
|
||||||
return $this->from($this->notificationEmail)
|
|
||||||
->subject("Payment from $company")
|
return $this->subject("Payment from $company")
|
||||||
->markdown('emails.send.payment', ['data', $this->data]);
|
->markdown('emails.send.payment', ['data', $this->data]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user