Files
fotospiel-app/database/seeders/DemoEventSeeder.php
Codex Agent 64a5411fb9 - Reworked the tenant admin login page
- Updated the User model to implement Filament’s tenancy contracts
- Seeded a ready-to-use demo tenant (user, tenant, active package, purchase)
- Introduced a branded, translated 403 error page to replace the generic forbidden message for unauthorised admin hits
- Removed the public “Register” links from the marketing header
- hardened join event logic and improved error handling in the guest pwa.
2025-10-13 12:50:46 +02:00

38 lines
1.2 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\{Event, EventType};
use App\Services\EventJoinTokenService;
class DemoEventSeeder extends Seeder
{
public function run(): void
{
$type = EventType::where('slug','wedding')->first();
if(!$type){ return; }
$demoTenant = \App\Models\Tenant::where('slug', 'demo')->first();
if (!$demoTenant) { return; }
$event = Event::updateOrCreate(['slug'=>'demo-wedding-2025'], [
'tenant_id' => $demoTenant->id,
'name' => ['de'=>'Demo Hochzeit 2025','en'=>'Demo Wedding 2025'],
'description' => ['de'=>'Demo-Event','en'=>'Demo event'],
'date' => now()->addMonths(3)->toDateString(),
'event_type_id' => $type->id,
'status' => 'published',
'is_active' => true,
'settings' => json_encode([]),
'default_locale' => 'de',
]);
if ($event->joinTokens()->count() === 0) {
/** @var EventJoinTokenService $service */
$service = app(EventJoinTokenService::class);
$service->createToken($event, [
'label' => 'Demo QR',
]);
}
}
}