Force HTTPS URLs in production

This commit is contained in:
2026-06-03 06:20:24 +05:00
parent 3ec4fe470e
commit 8e4f4b3267
+5
View File
@@ -4,6 +4,7 @@ namespace App\Providers;
use App\Models\Setting; use App\Models\Setting;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
@@ -21,6 +22,10 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
if ($this->app->environment('production')) {
URL::forceScheme('https');
}
if (config('database.default') === 'sqlite') { if (config('database.default') === 'sqlite') {
DB::statement('PRAGMA journal_mode=WAL'); DB::statement('PRAGMA journal_mode=WAL');
DB::statement('PRAGMA synchronous=NORMAL'); DB::statement('PRAGMA synchronous=NORMAL');