Tweak service providers for code readability
This commit is contained in:
parent
e83722cd88
commit
8f86e768d0
|
|
@ -22,23 +22,14 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
// Replace HTTP_HOST with site url setted in options to prevent CDN source problems
|
// Support *.tpl extension name
|
||||||
if (! option('auto_detect_asset_url')) {
|
|
||||||
$rootUrl = option('site_url');
|
|
||||||
|
|
||||||
if ($this->app['url']->isValidUrl($rootUrl)) {
|
|
||||||
$this->app['url']->forceRootUrl($rootUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option('force_ssl') || Utils::isRequestSecure()) {
|
|
||||||
$this->app['url']->forceSchema('https');
|
|
||||||
}
|
|
||||||
|
|
||||||
View::addExtension('tpl', 'blade');
|
View::addExtension('tpl', 'blade');
|
||||||
|
|
||||||
Event::listen(Events\RenderingHeader::class, function($event) {
|
// Control the URL generated by url() function
|
||||||
// Provide some application information for javascript
|
$this->configureUrlGenerator();
|
||||||
|
|
||||||
|
// Expose some app information to front-end
|
||||||
|
Event::listen(Events\RenderingHeader::class, function ($event) {
|
||||||
$blessing = array_merge(array_except(config('app'), ['key', 'providers', 'aliases', 'cipher', 'log', 'url']), [
|
$blessing = array_merge(array_except(config('app'), ['key', 'providers', 'aliases', 'cipher', 'log', 'url']), [
|
||||||
'base_url' => url('/'),
|
'base_url' => url('/'),
|
||||||
'site_name' => option_localized('site_name')
|
'site_name' => option_localized('site_name')
|
||||||
|
|
@ -54,6 +45,28 @@ class AppServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the \Illuminate\Routing\UrlGenerator.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register any application services.
|
* Register any application services.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,13 @@ class RuntimeCheckServiceProvider extends ServiceProvider
|
||||||
$this->checkFilePermissions();
|
$this->checkFilePermissions();
|
||||||
$this->checkDatabaseConnection();
|
$this->checkDatabaseConnection();
|
||||||
|
|
||||||
// Skip the installation check when setup or under CLI
|
// Skip the installation check on setup wizard or under CLI
|
||||||
if (! $request->is('setup*') && PHP_SAPI != "cli") {
|
if ($request->is('setup*') || $this->app->runningInConsole()) {
|
||||||
$this->checkInstallation();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redirect to setup wizard if not installed
|
||||||
|
$this->checkInstallation();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkFilePermissions()
|
protected function checkFilePermissions()
|
||||||
|
|
|
||||||
|
|
@ -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