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:
@@ -6,6 +6,7 @@ use App\Models\Event;
|
||||
use App\Support\JoinTokenLayoutRegistry;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class EventJoinTokenResource extends JsonResource
|
||||
{
|
||||
@@ -18,23 +19,25 @@ class EventJoinTokenResource extends JsonResource
|
||||
$eventFromRoute = $request->route('event');
|
||||
$eventContext = $eventFromRoute instanceof Event ? $eventFromRoute : ($this->resource->event ?? null);
|
||||
|
||||
$layouts = $eventContext
|
||||
? JoinTokenLayoutRegistry::toResponse(function (string $layoutId, string $format) use ($eventContext) {
|
||||
$layouts = [];
|
||||
if ($eventContext && Route::has('tenant.events.join-tokens.layouts.download')) {
|
||||
$layouts = JoinTokenLayoutRegistry::toResponse(function (string $layoutId, string $format) use ($eventContext) {
|
||||
return route('tenant.events.join-tokens.layouts.download', [
|
||||
'event' => $eventContext,
|
||||
'joinToken' => $this->resource,
|
||||
'layout' => $layoutId,
|
||||
'format' => $format,
|
||||
]);
|
||||
})
|
||||
: [];
|
||||
});
|
||||
}
|
||||
|
||||
$layoutsUrl = $eventContext
|
||||
? route('tenant.events.join-tokens.layouts.index', [
|
||||
$layoutsUrl = null;
|
||||
if ($eventContext && Route::has('tenant.events.join-tokens.layouts.index')) {
|
||||
$layoutsUrl = route('tenant.events.join-tokens.layouts.index', [
|
||||
'event' => $eventContext,
|
||||
'joinToken' => $this->resource,
|
||||
])
|
||||
: null;
|
||||
]);
|
||||
}
|
||||
|
||||
$plainToken = $this->resource->plain_token ?? $this->token;
|
||||
|
||||
@@ -50,7 +53,7 @@ class EventJoinTokenResource extends JsonResource
|
||||
'revoked_at' => optional($this->revoked_at)->toIso8601String(),
|
||||
'is_active' => $this->isActive(),
|
||||
'created_at' => optional($this->created_at)->toIso8601String(),
|
||||
'metadata' => $this->metadata ?? new \stdClass(),
|
||||
'metadata' => $this->metadata ?? new \stdClass,
|
||||
'layouts_url' => $layoutsUrl,
|
||||
'layouts' => $layouts,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user