mivita/app/Providers/AppServiceProvider.php
2026-04-14 18:07:45 +02:00

61 lines
1.9 KiB
PHP

<?php
namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
Paginator::defaultView('pagination::bootstrap-4');
Paginator::defaultSimpleView('pagination::simple-bootstrap-4');
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);
}
}
}