Tweak service providers for code readability
This commit is contained in:
parent
3cf5c646c6
commit
93b3a165ab
|
|
@ -22,20 +22,8 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
// Replace HTTP_HOST with site url setted in options to prevent CDN source problems
|
// Control the URL generated by url() function
|
||||||
if (! option('auto_detect_asset_url')) {
|
$this->configureUrlGenerator();
|
||||||
$rootUrl = option('site_url');
|
|
||||||
|
|
||||||
if ($this->app['url']->isValidUrl($rootUrl)) {
|
|
||||||
$this->app['url']->forceRootUrl($rootUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option('force_ssl') || Utils::isRequestSecure()) {
|
|
||||||
$this->app['url']->forceScheme('https');
|
|
||||||
}
|
|
||||||
|
|
||||||
View::addExtension('tpl', 'blade');
|
|
||||||
|
|
||||||
Event::listen(Events\RenderingHeader::class, function($event) {
|
Event::listen(Events\RenderingHeader::class, function($event) {
|
||||||
// Provide some application information for javascript
|
// Provide some application information for javascript
|
||||||
|
|
@ -72,5 +60,32 @@ class AppServiceProvider extends ServiceProvider
|
||||||
if ($this->app->environment() !== 'production') {
|
if ($this->app->environment() !== 'production') {
|
||||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Support *.tpl extension name
|
||||||
|
View::addExtension('tpl', 'blade');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the \Illuminate\Routing\UrlGenerator.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
protected function configureUrlGenerator()
|
||||||
|
{
|
||||||
|
if (! option('auto_detect_asset_url')) {
|
||||||
|
$rootUrl = option('site_url');
|
||||||
|
|
||||||
|
// Replace HTTP_HOST with site_url set in options,
|
||||||
|
// to prevent CDN source problems.
|
||||||
|
if ($this->app['url']->isValidUrl($rootUrl)) {
|
||||||
|
$this->app['url']->forceRootUrl($rootUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option('force_ssl') || Utils::isRequestSecure()) {
|
||||||
|
$this->app['url']->forceSchema('https');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,6 @@ return [
|
||||||
'Option' => App\Services\Facades\Option::class,
|
'Option' => App\Services\Facades\Option::class,
|
||||||
'Utils' => App\Services\Utils::class,
|
'Utils' => App\Services\Utils::class,
|
||||||
'Minecraft' => App\Services\Minecraft::class,
|
'Minecraft' => App\Services\Minecraft::class,
|
||||||
'Updater' => App\Services\Updater::class,
|
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user