feat(addons): finalize event addon catalog and ai styling upgrade flow
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Resources\Tenant;
|
||||
|
||||
use App\Models\WatermarkSetting;
|
||||
use App\Services\Addons\EventAddonCatalog;
|
||||
use App\Services\AiEditing\AiStylingEntitlementService;
|
||||
use App\Services\AiEditing\EventAiEditingPolicyService;
|
||||
use App\Services\Packages\PackageLimitEvaluator;
|
||||
@@ -222,11 +223,17 @@ class EventResource extends JsonResource
|
||||
? $eventPackage->addons
|
||||
: $eventPackage->addons()->latest()->take(10)->get();
|
||||
|
||||
return $addons->map(function ($addon) {
|
||||
$addonLabels = collect(app(EventAddonCatalog::class)->all())
|
||||
->mapWithKeys(fn (array $addon, string $key): array => [$key => $addon['label'] ?? null])
|
||||
->all();
|
||||
|
||||
return $addons->map(function ($addon) use ($addonLabels) {
|
||||
return [
|
||||
'id' => $addon->id,
|
||||
'key' => $addon->addon_key,
|
||||
'label' => $addon->metadata['label'] ?? null,
|
||||
'label' => $addon->metadata['label']
|
||||
?? ($addonLabels[$addon->addon_key] ?? null)
|
||||
?? $addon->addon_key,
|
||||
'status' => $addon->status,
|
||||
'variant_id' => $addon->variant_id,
|
||||
'transaction_id' => $addon->transaction_id,
|
||||
|
||||
Reference in New Issue
Block a user