diff --git a/app/Console/Commands/CreateTemplateCommand.php b/app/Console/Commands/CreateTemplateCommand.php index 613457e9..a4f22104 100644 --- a/app/Console/Commands/CreateTemplateCommand.php +++ b/app/Console/Commands/CreateTemplateCommand.php @@ -50,8 +50,7 @@ class CreateTemplateCommand extends Command } Storage::disk('views')->copy("/app/pdf/{$type}/{$type}1.blade.php", "/app/pdf/{$type}/{$templateName}.blade.php"); - copy(public_path("/build/img/PDF/{$type}1.png"), public_path("/build/img/PDF/{$templateName}.png")); - copy(resource_path("/static/img/PDF/{$type}1.png"), resource_path("/static/img/PDF/{$templateName}.png")); + copy(resource_path("static/img/PDF/{$type}1.png"), resource_path("static/img/PDF/{$templateName}.png")); $path = resource_path("views/app/pdf/{$type}/{$templateName}.blade.php"); $type = ucfirst($type); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index ee5f193f..e4bc504d 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -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;