<?php

namespace App\Providers;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // N+1 sorgu tespiti — production'da kapalı, local/staging'de açık
        Model::preventLazyLoading(!app()->isProduction());

        // Production'da HTTPS zorunlu kıl (reverse proxy arkasında da çalışır)
        if (app()->isProduction()) {
            URL::forceScheme('https');
        }
    }
}
