invoice Mail, weitere Punkte
This commit is contained in:
parent
02e78e7255
commit
39ef16686a
10 changed files with 299 additions and 6 deletions
50
app/Mail/MailInvoice.php
Normal file
50
app/Mail/MailInvoice.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use App\Services\Invoice;
|
||||
use App\Models\ShoppingOrder;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Storage;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailInvoice extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $shopping_order;
|
||||
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct(ShoppingOrder $shopping_order)
|
||||
{
|
||||
$this->shopping_order = $shopping_order;
|
||||
$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 = Invoice::getFilename($this->shopping_order);
|
||||
$path = Invoice::getDownloadPath($this->shopping_order);
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
return;
|
||||
}
|
||||
$file = Storage::disk('public')->path($path);
|
||||
$mime = Storage::disk('public')->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