FEATURE: prevent running some service providers in artisan

This commit is contained in:
Michal Kváček
2016-03-22 16:02:08 +01:00
parent 98090f69df
commit 28c065e106
3 changed files with 18 additions and 3 deletions
+6
View File
@@ -11,6 +11,7 @@ use App\Handlers\Search\Files;
use App\Handlers\Search\Presenters\AdminContent as AdminContentPresenter;
use App\Handlers\Search\Presenters\AdminFiles;
use App\Widgets\HtmlCode\HtmlCode;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@@ -22,6 +23,11 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
// ignore running from artisan
if (App::runningInConsole()) {
return;
}
$this->registerWidgets();
$this->registerTemplates();
$this->registerSettings();
+6
View File
@@ -3,6 +3,7 @@
namespace App\Providers;
use App\Models\Settings;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
@@ -15,6 +16,11 @@ class GlobalViewDataProvider extends ServiceProvider
*/
public function boot()
{
// ignore running from artisan
if (App::runningInConsole()) {
return;
}
$settings = new Settings();
foreach ($settings->getForView() as $key => $value) {
+6 -3
View File
@@ -3,17 +3,22 @@
namespace App\Providers;
use App\Models\Module;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
class ModuleManager extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
// ignore running from artisan
if (App::runningInConsole()) {
return;
}
// this service provider needs published config - config is merged right after this service provider
$modules = Module::get();
@@ -25,7 +30,6 @@ class ModuleManager extends ServiceProvider
/**
* Register the application services.
*
* @return void
*/
public function register()
@@ -34,7 +38,6 @@ class ModuleManager extends ServiceProvider
/**
* Read config file and merge it with module config in database.
*
* This method REQUIRES published config of given module (otherwise config(modulename) is not available)!
*
* @param Module $module