1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Services/Credit/GetCreditPdf.php
michael-hampton f7650d0692
Ft email (#3326)
* Emails

* change to user service

* refactor emails

* refactor emails

* refactor emails

* refactor emails

* emails

* emails

* emails

* emails

* emails

* emails

* emails

* emails

* emails

* emails

* Update EmailPayment.php

* Update SendEmail.php

* Update SendEmail.php

* Update SendEmail.php

* Update and rename BuildEmail.php to EmailBuilder.php

* Create InvoiceEmail

* Create QuoteEmail.php

* Rename InvoiceEmail to InvoiceEmail.php

* Create PaymentEmail.php

* Update SendEmail.php

* Update SendEmail.php

* Update SendEmail.php

* Update SendEmail.php

* Update InvoiceEmail.php

* Update EmailInvoice.php

* Update SendEmail.php

* Update TemplateEmail.php

* Update EmailBuilder.php

* Update InvoiceEmail.php

* Update QuoteEmail.php

* Update PaymentEmail.php

* Update InvoiceEmail.php

* Update QuoteEmail.php

* Update QuoteInvitation.php

* Update EmailQuote.php

* Update SendEmail.php

* Update SendEmail.php

* Update PaymentService.php

* Update PaymentEmail.php

* Update PaymentEmail.php

* Update PaymentEmail.php

* Update EmailBuilder.php

* Update PaymentEmail.php

* Update EmailPayment.php

* Update SendEmail.php

* Update InvoiceService.php

* Update SendEmail.php

* Update PaymentService.php

* Update SendEmail.php

* Update QuoteService.php

* Update EmailPayment.php

Co-authored-by: David Bomba <turbo124@gmail.com>
2020-02-15 20:01:15 +11:00

34 lines
768 B
PHP

<?php
namespace App\Services\Credit;
use App\Jobs\Invoice\CreateInvoicePdf;
use Illuminate\Support\Facades\Storage;
class GetCreditPdf
{
public function __construct()
{
}
public function __invoke($credit, $contact = null)
{
if (!$contact) {
$contact = $credit->customer->primary_contact()->first();
}
$path = 'public/' . $credit->customer->id . '/credits/';
$file_path = $path . $credit->number . '.pdf';
$disk = config('filesystems.default');
$file = Storage::disk($disk)->exists($file_path);
if (!$file) {
$file_path = CreateInvoicePdf::dispatchNow($this, $credit->account, $contact);
}
return Storage::disk($disk)->url($file_path);
}
}