Vermieterdaten, Bank, Steuerangabe, Adressen, Betriebsart und Fristen sind
Spalten von `tenants`. `App\Tenancy\TenantConfig` legt sie über
`config('fewo.*')` und `mail.from`, sobald der Mandantenkontext wechselt –
so lesen Vorlagen, Mails und der Mietvertrag weiter dieselben Schlüssel und
`resources/themes/**` bleibt unangetastet.
Die `.env` ist die Grundlinie: Rückfall, solange kein Mandant feststeht, und
Grenze für Löschfristen und Bot-Schutz (nur verschärfen, nicht lockern). Die
Flutgrenze bleibt global. Bank, Steuerangabe und eigene Dienst-Schlüssel
liegen verschlüsselt.
Die Seite System › Betrieb schreibt jetzt den Mandanten und enthält
zusätzlich Vermieterdaten, Bank und die Fristen. Tabelle `settings` und
Modell `Setting` entfallen; die Migration übernimmt die bisherigen Werte
aus `settings` und der Konfiguration in den Mandanten Stommer.
Neu: `tenant_services` (Freischaltung je Dienst mit optionalem eigenem
API-Schlüssel, nur im Betreiber-Bereich schaltbar) und `service_usages`.
Es zählt noch nichts, weil kein Dienst aufruft.
235 Feature-Tests grün. Der Umbauweg wurde zusätzlich auf einer Kopie der
lokalen Datenbank durchgespielt.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Support\StripImageMetadata;
|
|
use App\Tenancy\TenantConfig;
|
|
use App\Tenancy\TenantContext;
|
|
use Illuminate\Support\Facades\Event;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
|
|
use Throwable;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(TenantContext::class);
|
|
$this->app->singleton(TenantConfig::class);
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Operating data of the landlord (addresses, periods) and test mode (every e-mail goes to the test
|
|
// recipient only, until switched live). Console and boot know the landlord only if there is exactly one.
|
|
try {
|
|
$this->app->make(TenantConfig::class)->refresh();
|
|
} catch (Throwable) {
|
|
// no database yet (package discovery, first install)
|
|
}
|
|
|
|
// Photos: remove metadata (GPS position, camera data) from uploaded originals, which stay downloadable.
|
|
Event::listen(MediaHasBeenAddedEvent::class, fn (MediaHasBeenAddedEvent $event) => StripImageMetadata::strip($event->media));
|
|
|
|
// On Strato the domain points at the deployment folder and .htaccess forwards to current/public;
|
|
// without a fixed root, some URLs (e.g. /sitemap.xml) would be generated with /current/public.
|
|
if (! $this->app->environment('local', 'testing')) {
|
|
URL::forceRootUrl(config('app.url'));
|
|
URL::forceScheme(parse_url((string) config('app.url'), PHP_URL_SCHEME) ?: 'https');
|
|
}
|
|
}
|
|
}
|