Plugins base (#613)

* wip

* wip

* cleanup

* notification channels

* phpstan

* services

* remove server types

* refactoring

* refactoring
This commit is contained in:
Saeed Vaziry
2025-06-14 14:35:18 +02:00
committed by GitHub
parent adc0653d15
commit 131b828807
311 changed files with 3976 additions and 2660 deletions

View File

@ -17,7 +17,12 @@ public function install(Server $server, array $input): Service
{
Validator::make($input, self::rules($input))->validate();
$input['type'] = config('core.service_types')[$input['name']];
$name = $input['name'];
$input['type'] = config("service.services.$name.type");
if (! $input['type']) {
throw new \InvalidArgumentException("Service type is not defined for $name");
}
$service = new Service([
'server_id' => $server->id,
@ -55,14 +60,14 @@ public static function rules(array $input): array
$rules = [
'name' => [
'required',
Rule::in(array_keys(config('core.service_types'))),
Rule::in(array_keys(config('service.services'))),
],
'version' => [
'required',
],
];
if (isset($input['name'])) {
$rules['version'][] = Rule::in(config("core.service_versions.{$input['name']}"));
$rules['version'][] = Rule::in(config("service.services.{$input['name']}.versions", []));
}
return $rules;