mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 10:21:37 +00:00
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\SSH\Services\ProcessManager;
|
|
|
|
use App\SSH\Services\AbstractService;
|
|
use Closure;
|
|
|
|
abstract class AbstractProcessManager extends AbstractService implements ProcessManager
|
|
{
|
|
public function creationRules(array $input): array
|
|
{
|
|
return [
|
|
'type' => [
|
|
'required',
|
|
function (string $attribute, mixed $value, Closure $fail) {
|
|
$processManagerExists = $this->service->server->processManager();
|
|
if ($processManagerExists) {
|
|
$fail('You already have a process manager service on the server.');
|
|
}
|
|
},
|
|
],
|
|
];
|
|
}
|
|
|
|
public function deletionRules(): array
|
|
{
|
|
return [
|
|
'service' => [
|
|
function (string $attribute, mixed $value, Closure $fail) {
|
|
$hasQueue = $this->service->server->queues()->exists();
|
|
if ($hasQueue) {
|
|
$fail('You have queue(s) on the server.');
|
|
}
|
|
},
|
|
],
|
|
];
|
|
}
|
|
}
|