This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

View File

@ -0,0 +1,46 @@
<?php
namespace App\Jobs\Site;
use App\Events\Broadcast;
use App\Jobs\Job;
use App\Models\Site;
use App\SSHCommands\EditFileCommand;
use Throwable;
class DeployEnv extends Job
{
protected Site $site;
public function __construct(Site $site)
{
$this->site = $site;
}
/**
* @throws Throwable
*/
public function handle(): void
{
$this->site->server->ssh()->exec(
new EditFileCommand(
$this->site->path.'/.env',
$this->site->env
)
);
event(
new Broadcast('deploy-site-env-finished', [
'site' => $this->site,
])
);
}
public function failed(): void
{
event(
new Broadcast('deploy-site-env-failed', [
'site' => $this->site,
])
);
}
}