user(); if ($user && $user->isCopyReader()) { $criticalIngredients = app(InventoryService::class)->criticalIngredientCount(); $criticalProducts = app(ProductStockService::class)->criticalProductCount(); } $view->with('criticalIngredientCount', $criticalIngredients); $view->with('criticalProductCount', $criticalProducts); }); } /** * Register any application services. * * @return void */ public function register() { if ($this->app->environment() !== 'production') { $this->app->register(IdeHelperServiceProvider::class); } // ... } }