added install request

This commit is contained in:
Denis Duliçi
2022-02-14 18:00:44 +03:00
parent 6b10f5a200
commit a179232734
8 changed files with 111 additions and 11 deletions

View File

@@ -3,10 +3,13 @@
namespace App\Jobs\Install;
use App\Abstracts\Job;
use App\Traits\Modules;
use App\Utilities\Console;
class DisableModule extends Job
{
use Modules;
protected $alias;
protected $company_id;
@@ -34,6 +37,8 @@ class DisableModule extends Job
*/
public function handle()
{
$this->authorize();
$command = "module:disable {$this->alias} {$this->company_id} {$this->locale}";
$result = Console::run($command);
@@ -42,4 +47,14 @@ class DisableModule extends Job
throw new \Exception($result);
}
}
/**
* Determine if this action is applicable.
*/
public function authorize(): void
{
if (! $this->moduleExists($this->alias)) {
throw new \Exception("Module [{$this->alias}] not found.");
}
}
}

View File

@@ -3,10 +3,13 @@
namespace App\Jobs\Install;
use App\Abstracts\Job;
use App\Traits\Modules;
use App\Utilities\Console;
class EnableModule extends Job
{
use Modules;
protected $alias;
protected $company_id;
@@ -34,6 +37,8 @@ class EnableModule extends Job
*/
public function handle()
{
$this->authorize();
$command = "module:enable {$this->alias} {$this->company_id} {$this->locale}";
$result = Console::run($command);
@@ -42,4 +47,14 @@ class EnableModule extends Job
throw new \Exception($result);
}
}
/**
* Determine if this action is applicable.
*/
public function authorize(): void
{
if (! $this->moduleExists($this->alias)) {
throw new \Exception("Module [{$this->alias}] not found.");
}
}
}

View File

@@ -5,12 +5,15 @@ namespace App\Jobs\Install;
use App\Abstracts\Job;
use App\Interfaces\Listener\ShouldUpdateAllCompanies;
use App\Models\Module\Module;
use App\Traits\Modules;
use App\Utilities\Console;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\File;
class FinishUpdate extends Job
{
use Modules;
protected $alias;
protected $new;
@@ -37,6 +40,8 @@ class FinishUpdate extends Job
public function handle(): void
{
$this->authorize();
$companies = $this->getCompanies();
foreach ($companies as $company) {
@@ -52,6 +57,16 @@ class FinishUpdate extends Job
}
}
/**
* Determine if this action is applicable.
*/
public function authorize(): void
{
if (! $this->moduleExists($this->alias)) {
throw new \Exception("Module [{$this->alias}] not found.");
}
}
public function getCompanies()
{
if ($this->alias == 'core') {

View File

@@ -3,10 +3,13 @@
namespace App\Jobs\Install;
use App\Abstracts\Job;
use App\Traits\Modules;
use App\Utilities\Console;
class InstallModule extends Job
{
use Modules;
protected $alias;
protected $company_id;
@@ -34,6 +37,8 @@ class InstallModule extends Job
*/
public function handle()
{
$this->authorize();
$command = "module:install {$this->alias} {$this->company_id} {$this->locale}";
$result = Console::run($command);
@@ -44,4 +49,14 @@ class InstallModule extends Job
throw new \Exception($message);
}
}
/**
* Determine if this action is applicable.
*/
public function authorize(): void
{
if (! $this->moduleExists($this->alias)) {
throw new \Exception("Module [{$this->alias}] not found.");
}
}
}

View File

@@ -3,10 +3,13 @@
namespace App\Jobs\Install;
use App\Abstracts\Job;
use App\Traits\Modules;
use App\Utilities\Console;
class UninstallModule extends Job
{
use Modules;
protected $alias;
protected $company_id;
@@ -34,6 +37,8 @@ class UninstallModule extends Job
*/
public function handle()
{
$this->authorize();
$command = "module:uninstall {$this->alias} {$this->company_id} {$this->locale}";
$result = Console::run($command);
@@ -42,4 +47,14 @@ class UninstallModule extends Job
throw new \Exception($result);
}
}
/**
* Determine if this action is applicable.
*/
public function authorize(): void
{
if (! $this->moduleExists($this->alias)) {
throw new \Exception("Module [{$this->alias}] not found.");
}
}
}