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 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.");
}
}
}