mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Plugins base (#613)
* wip * wip * cleanup * notification channels * phpstan * services * remove server types * refactoring * refactoring
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
use App\Models\Service;
|
||||
use App\Models\Site;
|
||||
use App\Models\Worker;
|
||||
use App\SSH\Services\ProcessManager\ProcessManager;
|
||||
use App\Services\ProcessManager\ProcessManager;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
@ -26,6 +26,7 @@ public function create(Server $server, array $input, ?Site $site = null): void
|
||||
$worker = new Worker([
|
||||
'server_id' => $server->id,
|
||||
'site_id' => $site?->id,
|
||||
'name' => $input['name'],
|
||||
'command' => $input['command'],
|
||||
'user' => $input['user'],
|
||||
'auto_start' => $input['auto_start'] ? 1 : 0,
|
||||
@ -63,6 +64,19 @@ public function create(Server $server, array $input, ?Site $site = null): void
|
||||
public static function rules(Server $server, ?Site $site = null): array
|
||||
{
|
||||
return [
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
Rule::unique('workers')->where(function ($query) use ($server, $site) {
|
||||
return $query->where('server_id', $server->id)
|
||||
->where(function ($query) use ($site) {
|
||||
if ($site) {
|
||||
$query->where('site_id', $site->id);
|
||||
}
|
||||
});
|
||||
}),
|
||||
],
|
||||
'command' => [
|
||||
'required',
|
||||
],
|
||||
|
Reference in New Issue
Block a user