added invoice/bill number to pdf filename

This commit is contained in:
denisdulici
2020-04-18 17:17:01 +03:00
parent a8acd6b41b
commit d8362d2ed0
4 changed files with 29 additions and 3 deletions

View File

@ -2,6 +2,8 @@
namespace App\Traits;
use Illuminate\Support\Str;
trait Sales
{
/**
@ -60,4 +62,14 @@ trait Sales
return $statuses;
}
public function getInvoiceFileName($invoice, $separator = '-', $extension = 'pdf')
{
return $this->getSafeInvoiceNumber($invoice, $separator) . $separator . time() . '.' . $extension;
}
public function getSafeInvoiceNumber($invoice, $separator = '-')
{
return Str::slug($invoice->invoice_number, $separator, language()->getShortCode());
}
}