Overided Default Laravel Command

This commit is contained in:
devansh bawari 2020-11-25 18:08:49 +05:30
parent 004dcf2663
commit 7abf408a45
3 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace Webkul\Core\Console\Commands;
use Illuminate\Foundation\Console\DownCommand as OriginalCommand;
use Webkul\Core\Models\Channel;
class DownCommand extends OriginalCommand
{
public function handle()
{
$this->downAllChannel();
parent::handle();
}
protected function downAllChannel()
{
$this->comment('All channels are down.');
return Channel::query()->update(['is_maintenance_on' => 1]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Webkul\Core\Console\Commands;
use Illuminate\Foundation\Console\UpCommand as OriginalCommand;
use Webkul\Core\Models\Channel;
class UpCommand extends OriginalCommand
{
public function handle()
{
$this->upAllChannel();
parent::handle();
}
protected function upAllChannel()
{
$this->comment('Activating all channels.');
return Channel::query()->update(['is_maintenance_on' => 0]);
}
}

View File

@ -12,8 +12,10 @@ use Webkul\Theme\ViewRenderEventManager;
use Illuminate\Support\Facades\Validator;
use Webkul\Core\Console\Commands\Install;
use Webkul\Core\Observers\SliderObserver;
use Webkul\Core\Console\Commands\UpCommand;
use Webkul\Core\Facades\Core as CoreFacade;
use Webkul\Core\Console\Commands\BookingCron;
use Webkul\Core\Console\Commands\DownCommand;
use Webkul\Core\View\Compilers\BladeCompiler;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Webkul\Core\Console\Commands\BagistoVersion;
@ -65,6 +67,14 @@ class CoreServiceProvider extends ServiceProvider
Event::listen('bagisto.admin.layout.head', static function(ViewRenderEventManager $viewRenderEventManager) {
$viewRenderEventManager->addTemplate('core::blade.tracer.style');
});
$this->app->extend('command.down', function () {
return new DownCommand;
});
$this->app->extend('command.up', function () {
return new UpCommand;
});
}
/**