feat: extend event toolkit and polish guest pwa

This commit is contained in:
Codex Agent
2025-10-28 18:28:22 +01:00
parent f29067f570
commit a7bbf230fd
45 changed files with 3809 additions and 351 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class InviteLayout extends Model
{
use HasFactory;
protected $fillable = [
'slug',
'name',
'subtitle',
'description',
'paper',
'orientation',
'preview',
'layout_options',
'instructions',
'is_active',
'created_by',
];
protected $casts = [
'preview' => 'array',
'layout_options' => 'array',
'instructions' => 'array',
'is_active' => 'bool',
];
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class TenantFeedback extends Model
{
use HasFactory;
protected $table = 'tenant_feedback';
protected $guarded = [];
protected $casts = [
'metadata' => 'array',
];
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class);
}
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Carbon\CarbonInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -43,6 +44,10 @@ class TenantPackage extends Model
public function isActive(): bool
{
if ($this->package && $this->package->isEndcustomer()) {
return (bool) $this->active;
}
return $this->active && (! $this->expires_at || $this->expires_at->isFuture());
}
@@ -76,23 +81,43 @@ class TenantPackage extends Model
{
parent::boot();
static::creating(function ($tenantPackage) {
static::creating(function (self $tenantPackage) {
if (! $tenantPackage->purchased_at) {
$tenantPackage->purchased_at = now();
}
if (! $tenantPackage->expires_at && $tenantPackage->package) {
$tenantPackage->expires_at = now()->addYear(); // Standard für Reseller
$package = $tenantPackage->package;
if ($package && $package->isReseller()) {
if (! $tenantPackage->expires_at) {
$tenantPackage->expires_at = now()->addYear();
}
} else {
$tenantPackage->expires_at = now()->addCentury();
}
if ($tenantPackage->active === null) {
$tenantPackage->active = true;
}
$tenantPackage->active = true;
});
static::updating(function ($tenantPackage) {
if (
$tenantPackage->isDirty('expires_at')
&& $tenantPackage->expires_at instanceof \Carbon\CarbonInterface
&& $tenantPackage->expires_at->isPast()
) {
$tenantPackage->active = false;
static::updating(function (self $tenantPackage) {
$package = $tenantPackage->package;
if ($package && $package->isReseller()) {
if (
$tenantPackage->isDirty('expires_at')
&& $tenantPackage->expires_at instanceof CarbonInterface
&& $tenantPackage->expires_at->isPast()
) {
$tenantPackage->active = false;
}
return;
}
if ($tenantPackage->isDirty('expires_at')) {
$tenantPackage->expires_at = now()->addCentury();
}
});
}