fixed event join token handling in the event admin. created new seeders with new tenants and package purchases. added new playwright test scenarios.
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Resources\Tenant;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Http\Resources\MissingValue;
|
||||
|
||||
class EventResource extends JsonResource
|
||||
{
|
||||
@@ -12,6 +13,21 @@ class EventResource extends JsonResource
|
||||
$tenantId = $request->attributes->get('tenant_id');
|
||||
$showSensitive = $this->tenant_id === $tenantId;
|
||||
$settings = is_array($this->settings) ? $this->settings : [];
|
||||
$eventPackage = null;
|
||||
|
||||
if ($this->relationLoaded('eventPackages')) {
|
||||
$related = $this->getRelation('eventPackages');
|
||||
|
||||
if (! $related instanceof MissingValue) {
|
||||
$eventPackage = $related->first();
|
||||
}
|
||||
} elseif ($this->relationLoaded('eventPackage')) {
|
||||
$related = $this->getRelation('eventPackage');
|
||||
|
||||
if (! $related instanceof MissingValue) {
|
||||
$eventPackage = $related;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
@@ -36,6 +52,13 @@ class EventResource extends JsonResource
|
||||
'is_public' => $this->status === 'published',
|
||||
'public_share_url' => null,
|
||||
'qr_code_url' => null,
|
||||
'package' => $eventPackage ? [
|
||||
'id' => $eventPackage->package_id,
|
||||
'name' => $eventPackage->package?->getNameForLocale(app()->getLocale()) ?? $eventPackage->package?->name,
|
||||
'price' => $eventPackage->purchased_price,
|
||||
'purchased_at' => $eventPackage->purchased_at?->toIso8601String(),
|
||||
'expires_at' => $eventPackage->gallery_expires_at?->toIso8601String(),
|
||||
] : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user