Commit e0a616b2 authored by Mehedi Hassan's avatar Mehedi Hassan Committed by Nicolas Widart

Stop making DB queries on console mode (#356)

* Stop making DB queries on console mode

* using === true on condition
parent b68e85a4
...@@ -12,7 +12,7 @@ class AsgardServiceProvider extends ServiceProvider ...@@ -12,7 +12,7 @@ class AsgardServiceProvider extends ServiceProvider
{ {
public function register() public function register()
{ {
if (class_exists(TranslationServiceProvider::class)) { if ($this->app->runningInConsole() === false && class_exists(TranslationServiceProvider::class)) {
$this->app->register(TranslationServiceProvider::class); $this->app->register(TranslationServiceProvider::class);
} }
......
...@@ -248,7 +248,7 @@ class CoreServiceProvider extends ServiceProvider ...@@ -248,7 +248,7 @@ class CoreServiceProvider extends ServiceProvider
*/ */
private function setLocalesConfigurations() private function setLocalesConfigurations()
{ {
if (! $this->app['asgard.isInstalled']) { if ($this->app['asgard.isInstalled'] === false || $this->app->runningInConsole() === true) {
return; return;
} }
......
...@@ -176,9 +176,13 @@ class MenuServiceProvider extends ServiceProvider ...@@ -176,9 +176,13 @@ class MenuServiceProvider extends ServiceProvider
*/ */
private function registerMenus() private function registerMenus()
{ {
if ($this->app['asgard.isInstalled'] === false || $this->app['asgard.onBackend'] === true) { if ($this->app['asgard.isInstalled'] === false ||
$this->app['asgard.onBackend'] === true ||
$this->app->runningInConsole() === true
) {
return; return;
} }
$menu = $this->app->make(MenuRepository::class); $menu = $this->app->make(MenuRepository::class);
$menuItem = $this->app->make(MenuItemRepository::class); $menuItem = $this->app->make(MenuItemRepository::class);
foreach ($menu->allOnline() as $menu) { foreach ($menu->allOnline() as $menu) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment