Assign the existing site to one landlord so stommer.info can run tenancy.

Seebad 0.3 stays in this release. With a single landlord every host still reaches the default website.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-23 12:00:11 +02:00
1 parent d9e52c4789
commit 8ebc1a3878
93 files changed
+2506 -112

No files matched your search

+18
View File
@@ -3,7 +3,9 @@
namespace Database\Factories;
use App\Enums\UserRole;
use App\Models\Tenant;
use App\Models\User;
use App\Tenancy\TenantContext;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
@@ -18,6 +20,22 @@ class UserFactory extends Factory
*/
protected static ?string $password;
public function configure(): static
{
return $this->afterCreating(function (User $user): void {
if ($user->role === null || app(TenantContext::class)->id() !== null) {
return;
}
$tenant = Tenant::query()->count() === 1
? Tenant::query()->firstOrFail()
: Tenant::factory()->create();
app(TenantContext::class)->set($tenant);
$user->attachCurrentRole($tenant);
});
}
/**
* Define the model's default state.
*