mivita/app/Providers/AppServiceProvider.php
2025-10-20 17:42:08 +02:00

58 lines
1.8 KiB
PHP

<?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
// HOTFIX: DomainContext temporär deaktiviert
// TODO: Nach Claude v2 Implementation wieder aktivieren
\View::composer('*', function ($view) {
try {
// $context = app(\App\Domain\DomainContext::class);
// if ($context->type === 'main') {
// $view->with('user_shop', null);
// } else {
// $userShop = $context->userShop ?? \App\Services\Util::getUserShop();
// $view->with('user_shop', $userShop);
// }
// Temporär: Verwende immer das normale Verhalten
$view->with('user_shop', \App\Services\Util::getUserShop());
} 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);
}
}
}