app->singleton(\App\Services\StockService::class, function ($app) { return new \App\Services\StockService(); }); } /** * Bootstrap any application services. * * @return void */ public function boot() { Carbon::setLocale('id'); View::composer(['layouts.partials.sidebarMenu', 'dashboard', 'dealer_recap', 'back.*', 'warehouse_management.*'], function ($view) { $menuQuery = Menu::all(); $menus = []; foreach($menuQuery as $menu) { $menus[$menu->link] = $menu; } $view->with('menus', $menus); }); // Force HTTPS in production if needed if (config('app.env') === 'production') { // Force the application URL to include port if specified $appUrl = config('app.url'); if ($appUrl) { URL::forceRootUrl($appUrl); // Parse URL to check if it's HTTPS $parsedUrl = parse_url($appUrl); if (isset($parsedUrl['scheme']) && $parsedUrl['scheme'] === 'https') { URL::forceScheme('https'); } } } } }