- products.whitelabel_variant_id, product_images.position/size_cm mit Backfill aus Produktnamen - WhiteLabelResolver: Farbe vom Produkt, Kundenlogo je Position, Fehler statt stillem Rückfall; Altlogik für Produkte ohne Variante - Attribute: Variantenwert-Parsing und Farbname ohne Größe - Produkt- und Kundenformular um Variante, Position und Größe ergänzt - Lieferschein noch nicht umgestellt (WL-03, wartet auf K6/K7) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
40 lines
977 B
PHP
40 lines
977 B
PHP
<?php
|
|
|
|
namespace App\Services\WhiteLabel;
|
|
|
|
use App\Models\ProductImage;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
/**
|
|
* Ein aufgelöstes Etikett für eine Position (WL-02).
|
|
*/
|
|
final class ResolvedLabel
|
|
{
|
|
public const SOURCE_CUSTOMER = 'customer';
|
|
|
|
public const SOURCE_STANDARD = 'standard';
|
|
|
|
public function __construct(
|
|
public readonly ProductImage $image,
|
|
public readonly string $source,
|
|
public readonly string $position,
|
|
public readonly float $sizeCm,
|
|
public readonly float $volumeMl,
|
|
public readonly ?int $attributeId = null,
|
|
) {}
|
|
|
|
public function isCustomer(): bool
|
|
{
|
|
return $this->source === self::SOURCE_CUSTOMER;
|
|
}
|
|
|
|
public function sourceName(): string
|
|
{
|
|
return $this->isCustomer() ? 'Kundenlogo' : 'Standardetikett';
|
|
}
|
|
|
|
public function fileExists(): bool
|
|
{
|
|
return Storage::disk('public')->exists(ltrim($this->image->getImagePath(), '/'));
|
|
}
|
|
}
|