ldc-supportweb/app/Providers/AppServiceProvider.php

39 lines
909 B
PHP
Raw Normal View History

2020-11-18 10:23:51 +01:00
<?php
namespace App\Providers;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\URL;
2020-11-18 10:23:51 +01:00
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// * HTTPS FIX
2022-06-09 12:03:49 +02:00
URL::forceScheme('https');
2021-05-21 16:02:29 +02:00
2022-08-30 13:21:07 +00:00
// * HA PROXY FIX
App::singleton('clientIp', function () {
2022-08-30 13:21:07 +00:00
if (config('app.env') === 'local') {
return request()->getClientIp();
} else {
return request()->server('HTTP_X_FORWARDED_FOR') ??
request()->getClientIp();
2022-08-30 13:21:07 +00:00
}
});
// * LOCAL FORCE eg: for Carbon
setlocale(LC_ALL, \sprintf(
'%s_%s.UTF-8',
config('app.locale'),
\strtoupper(config('app.locale'))
));
2020-11-18 10:23:51 +01:00
}
}