Update Framework, Invoices
This commit is contained in:
parent
cc5c147c27
commit
9b0b5feb7e
174 changed files with 28356 additions and 8093 deletions
53
app/Mail/MailInvoice.php
Normal file
53
app/Mail/MailInvoice.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Services\Invoice;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserInvoice;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Storage;
|
||||
|
||||
class MailInvoice extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $shopping_order;
|
||||
protected $user_invoice;
|
||||
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct(ShoppingOrder $shopping_order, UserInvoice $user_invoice)
|
||||
{
|
||||
$this->shopping_order = $shopping_order;
|
||||
$this->user_invoice = $user_invoice;
|
||||
$this->subject = 'Rechnung zu Deiner Bestellung: '.$shopping_order->getLastShoppingPayment('reference') ;
|
||||
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
$title = __('email.invoice_title');
|
||||
$copy1line = __('email.invoice_copy1line').$this->shopping_order->getLastShoppingPayment('reference');
|
||||
|
||||
$filename = $this->user_invoice->filename;
|
||||
$disk = $this->user_invoice->disk;
|
||||
$path = $this->user_invoice->getDownloadPath();
|
||||
if (!Storage::disk($disk)->exists($path)) {
|
||||
return;
|
||||
}
|
||||
$file = Storage::disk($disk)->path($path);
|
||||
$file = str_replace('//', '/', $file);
|
||||
$mime = Storage::disk($disk)->mimeType($path);
|
||||
|
||||
return $this->view('emails.blank')->with([
|
||||
'title' => $title,
|
||||
'copy1line' => $copy1line,
|
||||
])->attach($file,[
|
||||
'as' => $filename,
|
||||
'mime' => $mime,
|
||||
]); // attach file;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue