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:
Codex Agent
2025-10-26 14:44:47 +01:00
parent 6290a3a448
commit ecf5a23b28
59 changed files with 3900 additions and 691 deletions

View File

@@ -2,21 +2,21 @@
namespace App\Models;
use App\Services\EventJoinTokenService;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use App\Models\EventStorageAssignment;
use App\Models\EventMediaAsset;
use App\Models\MediaStorageTarget;
class Event extends Model
{
use HasFactory;
protected $table = 'events';
protected $guarded = [];
protected $casts = [
'date' => 'datetime',
'is_active' => 'boolean',
@@ -24,6 +24,22 @@ class Event extends Model
'description' => 'array',
];
protected static function booted(): void
{
static::created(function (self $event): void {
if ($event->joinTokens()->exists()) {
return;
}
app(EventJoinTokenService::class)->createToken($event, [
'label' => 'Standard-Link',
'metadata' => [
'auto_generated' => true,
],
]);
});
}
public function storageAssignments(): HasMany
{
return $this->hasMany(EventStorageAssignment::class);
@@ -98,7 +114,7 @@ class Event extends Model
public function getPackageLimits(): array
{
if (!$this->hasActivePackage()) {
if (! $this->hasActivePackage()) {
return [];
}
@@ -107,7 +123,7 @@ class Event extends Model
public function canUploadPhoto(): bool
{
if (!$this->hasActivePackage()) {
if (! $this->hasActivePackage()) {
return false;
}

View File

@@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use App\Models\EventJoinTokenEvent;
use Illuminate\Support\Facades\Crypt;
class EventJoinToken extends Model
@@ -15,6 +14,7 @@ class EventJoinToken extends Model
protected $fillable = [
'event_id',
'token',
'token_hash',
'token_encrypted',
'token_preview',
@@ -36,6 +36,7 @@ class EventJoinToken extends Model
];
protected $hidden = [
'token',
'token_encrypted',
'token_hash',
];