update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
56
dev/app-bak/Providers/AppServiceProvider.php
Normal file
56
dev/app-bak/Providers/AppServiceProvider.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Schema::defaultStringLength(191);
|
||||
|
||||
if ($this->app->environment('production')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
// Domain-bewusster View Composer für user_shop
|
||||
\View::composer('*', function ($view) {
|
||||
try {
|
||||
$context = app(\App\Domain\DomainContext::class);
|
||||
|
||||
// Für die Main-Domain: user_shop immer auf null setzen
|
||||
if ($context->type === 'main') {
|
||||
$view->with('user_shop', null);
|
||||
} else {
|
||||
// Für alle anderen Domains: normales Verhalten
|
||||
$userShop = $context->userShop ?? \App\Services\Util::getUserShop();
|
||||
$view->with('user_shop', $userShop);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Fallback bei Fehlern
|
||||
$view->with('user_shop', \App\Services\Util::getUserShop());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
|
||||
if ($this->app->environment() !== 'production' && class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
37
dev/app-bak/Providers/AuthServiceProvider.php
Normal file
37
dev/app-bak/Providers/AuthServiceProvider.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Laravel\Passport\Passport;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
// Die neuere Passport-Konfiguration verwendet separate Methoden
|
||||
// anstelle von Passport::routes()
|
||||
Passport::tokensExpireIn(now()->addDays(15));
|
||||
Passport::refreshTokensExpireIn(now()->addDays(30));
|
||||
Passport::personalAccessTokensExpireIn(now()->addMonths(6));
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
21
dev/app-bak/Providers/BroadcastServiceProvider.php
Normal file
21
dev/app-bak/Providers/BroadcastServiceProvider.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
111
dev/app-bak/Providers/DomainServiceProvider.php
Normal file
111
dev/app-bak/Providers/DomainServiceProvider.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Domain\DomainContext;
|
||||
use App\Services\DomainService;
|
||||
use App\Services\UserShopSessionManager;
|
||||
use Illuminate\Contracts\Cookie\Factory as CookieFactory;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* Optimierter Domain-Service-Provider für GPT-5 v3.1
|
||||
*
|
||||
* Ersetzt den ursprünglichen DomainServiceProvider und registriert
|
||||
* die neuen optimierten Services ohne die problematische Middleware-Registrierung.
|
||||
*/
|
||||
class DomainServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Registriert die Domain-Services im Container
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
// 1. DomainService als Singleton (vom ursprünglichen Provider übernommen)
|
||||
$this->app->singleton(DomainService::class, function ($app) {
|
||||
$domainService = new DomainService($app['config']['domains']);
|
||||
|
||||
// Validiere Konfiguration in Development
|
||||
if (config('app.debug')) {
|
||||
$configErrors = $domainService->validateConfiguration();
|
||||
if (!empty($configErrors)) {
|
||||
\Log::channel('domain')->warning('Domain configuration errors detected', [
|
||||
'errors' => $configErrors
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $domainService;
|
||||
});
|
||||
|
||||
// 2. DomainContext als Singleton (vom ursprünglichen Provider übernommen)
|
||||
$this->app->singleton(DomainContext::class, function ($app) {
|
||||
/** @var DomainService $domainService */
|
||||
$domainService = $app->make(DomainService::class);
|
||||
$request = $app->make('request');
|
||||
|
||||
// Domain-Info analysieren
|
||||
$domainInfo = $domainService->parseDomain($request->getHost());
|
||||
|
||||
if (config('app.debug')) {
|
||||
\Log::channel('domain')->debug('DomainServiceProvider: domainInfo', [
|
||||
'domainInfo' => $domainInfo,
|
||||
'host' => $request->getHost()
|
||||
]);
|
||||
}
|
||||
|
||||
$userShop = null;
|
||||
|
||||
// UserShop-Domains: Shop-Objekt laden
|
||||
if ($domainInfo['type'] === 'user-shop' && $domainInfo['subdomain']) {
|
||||
$userShop = $domainService->getUserShop($domainInfo['subdomain']);
|
||||
if (!$userShop) {
|
||||
$domainInfo['type'] = 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
// Haupt-Shop-Domain: Fallback-Shop laden (Fix: Korrekter Type-Check)
|
||||
if ($domainInfo['type'] === 'shop' && !empty($domainInfo['default_user_shop'])) {
|
||||
$userShop = $domainService->getUserShop($domainInfo['default_user_shop']);
|
||||
}
|
||||
|
||||
return DomainContext::fromArray($domainInfo, $userShop);
|
||||
});
|
||||
|
||||
// 3. UserShopSessionManager registrieren (GPT-5 v3.1 neu)
|
||||
$this->app->singleton(UserShopSessionManager::class, function ($app) {
|
||||
return new UserShopSessionManager(
|
||||
$app->make(DomainService::class),
|
||||
$app->make(CookieFactory::class)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap-Aktionen (KEINE Middleware-Registrierung!)
|
||||
*
|
||||
* Im Gegensatz zum ursprünglichen DomainServiceProvider registrieren wir
|
||||
* KEINE Middleware hier - das passiert manuell im Kernel für bessere Kontrolle.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Konfiguration publishen (optional)
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->publishes([
|
||||
__DIR__ . '/../../config/subdomain.php' => config_path('subdomain.php'),
|
||||
], 'subdomain-config');
|
||||
}
|
||||
|
||||
// Debug-Logging für erfolgreiche Service-Registrierung
|
||||
if (config('app.debug')) {
|
||||
\Log::channel('domain')->debug('DomainServiceProvider: Services registered successfully', [
|
||||
'services' => [
|
||||
'DomainService' => DomainService::class,
|
||||
'DomainContext' => DomainContext::class,
|
||||
'UserShopSessionManager' => UserShopSessionManager::class,
|
||||
],
|
||||
'note' => 'Middleware must be registered manually in Http/Kernel.php'
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
dev/app-bak/Providers/EventServiceProvider.php
Normal file
32
dev/app-bak/Providers/EventServiceProvider.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\Event' => [
|
||||
'App\Listeners\EventListener',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
36
dev/app-bak/Providers/HorizonServiceProvider.php
Normal file
36
dev/app-bak/Providers/HorizonServiceProvider.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Horizon\Horizon;
|
||||
use Laravel\Horizon\HorizonApplicationServiceProvider;
|
||||
|
||||
class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
// Horizon::routeSmsNotificationsTo('15556667777');
|
||||
// Horizon::routeMailNotificationsTo('example@example.com');
|
||||
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Horizon gate.
|
||||
*
|
||||
* This gate determines who can access Horizon in non-local environments.
|
||||
*/
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewHorizon', function ($user = null) {
|
||||
return in_array(optional($user)->email, [
|
||||
//
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
130
dev/app-bak/Providers/RouteServiceProvider.php
Normal file
130
dev/app-bak/Providers/RouteServiceProvider.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Domain\DomainContext;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/';
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $namespace = 'App\\Http\\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// $this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
// API-Routen werden global geladen
|
||||
Route::domain('api.' . config('app.domain') . config('app.tld_care'))
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
// Web-Routen werden domain-bewusst geladen
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(function () {
|
||||
$this->loadDomainAwareRoutes();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt Routen basierend auf dem aktuellen Domain-Kontext.
|
||||
*/
|
||||
protected function loadDomainAwareRoutes(): void
|
||||
{
|
||||
/** @var DomainContext $context */
|
||||
$context = app(DomainContext::class);
|
||||
$this->loadSharedRoutes();
|
||||
if (config('app.debug')) {
|
||||
\Log::channel('domain')->info('loadDomainAwareRoutes', ['context' => $context]);
|
||||
}
|
||||
match ($context->type) {
|
||||
'main' => $this->loadDomainRoutes('main', 'main.php'),
|
||||
'main-shop' => [
|
||||
$this->loadDomainRoutes('shop', 'shop.php'),
|
||||
$this->loadDomainRoutes('portal', 'portal.php'),
|
||||
],
|
||||
'user-shop' => [
|
||||
$this->loadDomainRoutes('user-shop', 'user-shop.php'),
|
||||
$this->loadDomainRoutes('portal', 'portal.php'),
|
||||
],
|
||||
'crm' => $this->loadDomainRoutes('crm', 'crm.php'),
|
||||
'portal' => $this->loadDomainRoutes('portal', 'portal.php'),
|
||||
'checkout' => $this->loadDomainRoutes('checkout', 'checkout.php'),
|
||||
default => $this->loadAllDomainRoutesForCaching(),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt eine spezifische Routendatei für eine Domain.
|
||||
*/
|
||||
protected function loadDomainRoutes(string $domainType, string $fileName): void
|
||||
{
|
||||
$domain = config("domains.domains.{$domainType}.host");
|
||||
|
||||
Route::domain($domain)
|
||||
->group(base_path('routes/domains/' . $fileName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt alle domainspezifischen Routen.
|
||||
* Wird als Fallback für das Route-Caching benötigt.
|
||||
*/
|
||||
protected function loadAllDomainRoutesForCaching(): void
|
||||
{
|
||||
if (app()->routesAreCached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->loadDomainRoutes('main', 'main.php');
|
||||
$this->loadDomainRoutes('shop', 'shop.php');
|
||||
$this->loadDomainRoutes('crm', 'crm.php');
|
||||
$this->loadDomainRoutes('portal', 'portal.php');
|
||||
$this->loadDomainRoutes('checkout', 'checkout.php');
|
||||
$this->loadDomainRoutes('user-shop', 'user-shop.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt Routen, die auf allen Domains verfügbar sein sollen.
|
||||
*/
|
||||
protected function loadSharedRoutes(): void
|
||||
{
|
||||
// Lädt Routen, die auf allen Domains verfügbar sein sollen.
|
||||
Route::group([], base_path('routes/shared/common.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Konfiguriert die Rate-Limiter für die Anwendung.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
30
dev/app-bak/Providers/YardServiceProvider.php
Normal file
30
dev/app-bak/Providers/YardServiceProvider.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Services\Yard;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class YardServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton(Yard::class, function ($app) {
|
||||
return new Yard($app['session'], $app['events']);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue