renamed laravel packages

This commit is contained in:
Denis Duliçi
2021-03-05 15:30:01 +03:00
parent bc7488cf96
commit c16abc6f32
6 changed files with 339 additions and 339 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace Akaunting\Module\Commands;
use App\Console\Commands\UninstallModule;
class DeleteCommand extends UninstallModule
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'module:delete {alias} {company} {locale=en-GB}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete the specified module.';
}

View File

@ -0,0 +1,57 @@
<?php
namespace Akaunting\Module\Commands;
use App\Abstracts\Commands\Module as Command;
use App\Events\Module\Disabled;
class DisableCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'module:disable {alias} {company} {locale=en-GB}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Disable the specified module.';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->prepare();
if (!$this->getModel()) {
$this->info("Module [{$this->alias}] not found.");
return;
}
if (!$this->model->enabled) {
$this->comment("Module [{$this->alias}] is already disabled.");
return;
}
$this->changeRuntime();
// Update db
$this->model->enabled = false;
$this->model->save();
$this->createHistory('disabled');
event(new Disabled($this->alias, $this->company_id));
$this->revertRuntime();
$this->info("Module [{$this->alias}] disabled.");
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace Akaunting\Module\Commands;
use App\Abstracts\Commands\Module as Command;
use App\Events\Module\Enabled;
class EnableCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'module:enable {alias} {company} {locale=en-GB}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Enable the specified module.';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->prepare();
if (!$this->getModel()) {
$this->info("Module [{$this->alias}] not found.");
return;
}
if ($this->model->enabled) {
$this->comment("Module [{$this->alias}] is already enabled.");
return;
}
$this->changeRuntime();
// Update db
$this->model->enabled = true;
$this->model->save();
$this->createHistory('enabled');
event(new Enabled($this->alias, $this->company_id));
$this->revertRuntime();
$this->info("Module [{$this->alias}] enabled.");
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace Akaunting\Module\Commands;
use App\Abstracts\Commands\Module as Command;
use App\Events\Module\Installed;
use App\Models\Module\Module as Model;
class InstallCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'module:install {alias} {company} {locale=en-GB}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install the specified module.';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->prepare();
if ($this->getModel()) {
$this->comment("Module [{$this->alias}] is already installed.");
return;
}
$this->changeRuntime();
// Create db
$this->model = Model::create([
'company_id' => $this->company_id,
'alias' => $this->alias,
'enabled' => '1',
]);
$this->createHistory('installed');
event(new Installed($this->alias, $this->company_id, $this->locale));
$this->revertRuntime();
$this->info("Module [{$this->alias}] installed!");
}
}