app->singleton(GraphClientInterface::class, function ($app) { $config = $app['config']->get('graph'); $hasCredentials = ! empty($config['client_id']) && ! empty($config['client_secret']) && ! empty($config['tenant_id']); if (! empty($config['enabled']) && $hasCredentials) { return $app->make(MicrosoftGraphClient::class); } return $app->make(NullGraphClient::class); }); $this->app->tag( [ AppProtectionPolicyNormalizer::class, CompliancePolicyNormalizer::class, DeviceConfigurationPolicyNormalizer::class, EnrollmentAutopilotPolicyNormalizer::class, GroupPolicyConfigurationNormalizer::class, ManagedDeviceAppConfigurationNormalizer::class, ScriptsPolicyNormalizer::class, SettingsCatalogPolicyNormalizer::class, TermsAndConditionsNormalizer::class, WindowsDriverUpdateProfileNormalizer::class, WindowsFeatureUpdateProfileNormalizer::class, WindowsQualityUpdateProfileNormalizer::class, WindowsUpdateRingNormalizer::class, ], 'policy-type-normalizers' ); } /** * Bootstrap any application services. */ public function boot(): void { Event::listen(TenantSet::class, function (TenantSet $event): void { static $hasPreferencesTable; $hasPreferencesTable ??= Schema::hasTable('user_tenant_preferences'); if (! $hasPreferencesTable) { return; } $tenant = $event->getTenant(); $user = $event->getUser(); if (! $tenant instanceof Tenant) { return; } if (! $user instanceof User) { return; } UserTenantPreference::query()->updateOrCreate( [ 'user_id' => $user->getKey(), 'tenant_id' => $tenant->getKey(), ], [ 'last_used_at' => now(), ], ); }); Gate::policy(BackupSchedule::class, BackupSchedulePolicy::class); } }