48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\User;
|
|
use App\Models\Plan;
|
|
use App\Observers\UserObserver;
|
|
use App\Observers\PlanObserver;
|
|
use App\Providers\AssetServiceProvider;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(\App\Services\WebhookService::class);
|
|
|
|
// Register our AssetServiceProvider
|
|
$this->app->register(AssetServiceProvider::class);
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
if (str_contains(config('app.url', ''), 'https://') || $this->app->environment('production') || $this->app->environment('staging')) {
|
|
\Illuminate\Support\Facades\URL::forceScheme('https');
|
|
}
|
|
|
|
// Register the UserObserver
|
|
User::observe(UserObserver::class);
|
|
|
|
// Register the PlanObserver
|
|
Plan::observe(PlanObserver::class);
|
|
|
|
// Configure dynamic storage disks
|
|
try {
|
|
// \App\Services\DynamicStorageService::configureDynamicDisks();
|
|
} catch (\Exception $e) {
|
|
// Silently fail during migrations or when database is not ready
|
|
}
|
|
}
|
|
} |