first commit
This commit is contained in:
commit
405df0a122
3083 changed files with 69203 additions and 0 deletions
51
app/Providers/AppServiceProvider.php
Normal file
51
app/Providers/AppServiceProvider.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Force HTTPS when running behind a proxy (like Traefik)
|
||||
if ($this->app->environment('local', 'production')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
// Trust proxies for correct request detection
|
||||
$this->app['request']->server->set('HTTPS', 'on');
|
||||
|
||||
// Set dynamic asset URL based on current domain/theme
|
||||
// This is needed for Vite to use the correct asset subdomain
|
||||
//config(['app.asset_url' => 'https://assets.businessportal24.test']);
|
||||
|
||||
//$this->setDynamicAssetUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the asset URL dynamically based on the current theme
|
||||
*/
|
||||
protected function setDynamicAssetUrl(): void
|
||||
{
|
||||
try {
|
||||
$assetUrl = \App\Helpers\ThemeHelper::getAssetUrl();
|
||||
config(['app.asset_url' => $assetUrl]);
|
||||
} catch (\Exception $e) {
|
||||
// Fallback to default if theme detection fails
|
||||
config(['app.asset_url' => 'https://assets.pr-copilot.test']);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
app/Providers/FortifyServiceProvider.php
Normal file
52
app/Providers/FortifyServiceProvider.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Actions\Fortify\CreateNewUser;
|
||||
use App\Actions\Fortify\ResetUserPassword;
|
||||
use App\Actions\Fortify\UpdateUserPassword;
|
||||
use App\Actions\Fortify\UpdateUserProfileInformation;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Fortify\Actions\RedirectIfTwoFactorAuthenticatable;
|
||||
use Laravel\Fortify\Fortify;
|
||||
use Livewire\Volt\Volt;
|
||||
|
||||
class FortifyServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Nur die notwendigen Fortify-Aktionen behalten
|
||||
Fortify::createUsersUsing(CreateNewUser::class);
|
||||
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
|
||||
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
|
||||
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
|
||||
Fortify::redirectUserForTwoFactorAuthenticationUsing(RedirectIfTwoFactorAuthenticatable::class);
|
||||
|
||||
// Keine View-Definitionen, da wir Volt verwenden
|
||||
|
||||
RateLimiter::for('login', function (Request $request) {
|
||||
$throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())).'|'.$request->ip());
|
||||
|
||||
return Limit::perMinute(5)->by($throttleKey);
|
||||
});
|
||||
|
||||
RateLimiter::for('two-factor', function (Request $request) {
|
||||
return Limit::perMinute(5)->by($request->session()->get('login.id'));
|
||||
});
|
||||
}
|
||||
}
|
||||
90
app/Providers/ThemeServiceProvider.php
Normal file
90
app/Providers/ThemeServiceProvider.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\Facades\Vite;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ThemeServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
// Registriere die domains.php Konfigurationsdatei
|
||||
$this->mergeConfigFrom(
|
||||
base_path('config/domains.php'),
|
||||
'domains'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$host = Request::getHost(); // is domain_name
|
||||
$themeOverride = Request::get('theme'); // Allow theme override via URL parameter
|
||||
|
||||
// Standard-Werte für Domain, die nicht in der Konfiguration sind
|
||||
$domainConfig = [
|
||||
'name' => config('app.name'),
|
||||
'theme' => 'portal',
|
||||
'view_prefix' => 'portal',
|
||||
'assets_dir' => 'build/portal',
|
||||
'url' => config('app.url'),
|
||||
'domain_name' => config('app.domain_name'),
|
||||
];
|
||||
|
||||
// Lade die Domain-Konfiguration
|
||||
$confiDomains = config('domains.domains');
|
||||
|
||||
// Suche nach der aktuellen Domain in der Konfiguration
|
||||
foreach ($confiDomains as $name => $config) {
|
||||
if (is_array($config) && isset($config['domain_name']) && $config['domain_name'] === $host) {
|
||||
$domainConfig = array_merge($domainConfig, $config);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow theme override via URL parameter (for testing)
|
||||
if ($themeOverride && isset($confiDomains[$themeOverride])) {
|
||||
$domainConfig = array_merge($domainConfig, $confiDomains[$themeOverride]);
|
||||
}
|
||||
|
||||
// Grundlegende Konfiguration im Anwendungskontext verfügbar machen
|
||||
config([
|
||||
'app.theme' => $domainConfig['theme'],
|
||||
'app.view_prefix' => $domainConfig['view_prefix'],
|
||||
'app.domain_name' => $domainConfig['domain_name'],
|
||||
'app.url' => $domainConfig['url'],
|
||||
'app.asset_url' => $domainConfig['asset_url'] ?? $domainConfig['url'],
|
||||
]);
|
||||
|
||||
// Spezifischere Daten für die Views verfügbar machen
|
||||
View::share('theme', $domainConfig['theme']);
|
||||
View::share('viewPrefix', $domainConfig['view_prefix']);
|
||||
View::share('domainName', $domainConfig['domain_name']);
|
||||
View::share('domainConfig', $domainConfig);
|
||||
View::share('domainUrl', $domainConfig['url']);
|
||||
|
||||
// Vite-Assets-Konfiguration für die aktuelle Domain
|
||||
if (! app()->runningInConsole() && isset($domainConfig['assets_dir'])) {
|
||||
Vite::useBuildDirectory($domainConfig['assets_dir']);
|
||||
|
||||
// Setze die Asset-URL für Vite Dev-Server
|
||||
if (isset($domainConfig['asset_url'])) {
|
||||
// Erstelle temporäre Hot-File mit der richtigen Asset-URL
|
||||
$hotFile = public_path('hot');
|
||||
if (file_exists($hotFile)) {
|
||||
file_put_contents($hotFile, $domainConfig['asset_url']);
|
||||
}
|
||||
|
||||
Vite::useHotFile($hotFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
app/Providers/VoltServiceProvider.php
Normal file
28
app/Providers/VoltServiceProvider.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Livewire\Volt\Volt;
|
||||
|
||||
class VoltServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Volt::mount([
|
||||
config('livewire.view_path', resource_path('views/livewire')),
|
||||
resource_path('views/pages'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue