Fix: PDF Template command (#272)

* Fix `make:template` command

* Fix issue related to Vite assets

* Reformat code

---------

Co-authored-by: Steven Rombauts <steven@kotuha.be>
This commit is contained in:
Darko Gjorgjijoski
2025-01-12 16:19:54 +01:00
committed by GitHub
parent 1804481fc6
commit c617f7d169
2 changed files with 3 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Models;
use App;
use App\Mail\SendInvoiceMail;
use App\Services\SerialNumberFormatter;
use App\Space\ImageUtils;
use App\Traits\GeneratesPdfTrait;
use App\Traits\HasCustomFieldsTrait;
use Barryvdh\DomPDF\Facade\Pdf as PDF;
@@ -15,7 +16,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\Str;
use Nwidart\Modules\Facades\Module;
use Spatie\MediaLibrary\HasMedia;
@@ -665,7 +665,7 @@ class Invoice extends Model implements HasMedia
foreach ($templates as $key => $template) {
$templateName = Str::before(basename($template), '.blade.php');
$invoiceTemplates[$key]['name'] = $templateName;
$invoiceTemplates[$key]['path'] = Vite::asset('resources/static/img/PDF/'.$templateName.'.png');
$invoiceTemplates[$key]['path'] = ImageUtils::toBase64Src(resource_path('static/img/PDF/'.$templateName.'.png'));
}
return $invoiceTemplates;