Server : LiteSpeed System : Linux server335.web-hosting.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : cardxfeb ( 2452) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/cardxfeb/public_html/app/Providers/ |
<?php
namespace App\Providers;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Mariuzzo\LaravelJsLocalization\Commands\LangJsCommand;
use Mariuzzo\LaravelJsLocalization\Generators\LangJsGenerator;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
// Bind the Laravel JS Localization command into the app IOC.
$this->app->singleton('localization.js', function ($app) {
$app = $this->app;
$laravelMajorVersion = (int) $app::VERSION;
$files = $app['files'];
if ($laravelMajorVersion === 4) {
$langs = $app['path.base'].'/app/lang';
} elseif ($laravelMajorVersion >= 5 && $laravelMajorVersion < 9) {
$langs = $app['path.base'].'/resources/lang';
} elseif ($laravelMajorVersion >= 9) {
$langs = app()->langPath();
}
$messages = $app['config']->get('localization-js.messages');
$generator = new LangJsGenerator($files, $langs, $messages);
return new LangJsCommand($generator);
});
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// CARD AO SEGUNDO CONTROL - Force URL dinamica por dominio
if (isset($_SERVER['HTTP_HOST'])) {
$schema = app('request')->isSecure() ? 'https' : 'http';
\URL::forceRootUrl($schema . '://' . $_SERVER['HTTP_HOST']);
\URL::forceScheme('https');
}
app()->useLangPath(base_path('lang'));
View::share('mixID', time());
}
}