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()
|
||||
{
|
||||
// Replace HTTP_HOST with site url setted in options to prevent CDN source problems
|
||||
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');
|
||||
}
|
||||
|
||||
// Support *.tpl extension name
|
||||
View::addExtension('tpl', 'blade');
|
||||
|
||||
Event::listen(Events\RenderingHeader::class, function($event) {
|
||||
// Provide some application information for javascript
|
||||
// Control the URL generated by url() function
|
||||
$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']), [
|
||||
'base_url' => url('/'),
|
||||
'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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,10 +24,13 @@ class RuntimeCheckServiceProvider extends ServiceProvider
|
|||
$this->checkFilePermissions();
|
||||
$this->checkDatabaseConnection();
|
||||
|
||||
// Skip the installation check when setup or under CLI
|
||||
if (! $request->is('setup*') && PHP_SAPI != "cli") {
|
||||
$this->checkInstallation();
|
||||
// Skip the installation check on setup wizard or under CLI
|
||||
if ($request->is('setup*') || $this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Redirect to setup wizard if not installed
|
||||
$this->checkInstallation();
|
||||
}
|
||||
|
||||
protected function checkFilePermissions()
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@ return [
|
|||
'Option' => App\Services\Facades\Option::class,
|
||||
'Utils' => App\Services\Utils::class,
|
||||
'Minecraft' => App\Services\Minecraft::class,
|
||||
'Updater' => App\Services\Updater::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user