service credentials

This commit is contained in:
2025-05-22 13:38:56 +01:00
parent afde59bd39
commit ea5dcebe45
6 changed files with 29 additions and 22 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use App\Drivers\DatabaseDriver;
use App\Drivers\Driver;
use App\Enums\ServiceCategory;
use App\Enums\ServiceStatus;
@@ -57,11 +58,16 @@ class Service extends Model
throw new \Exception("Driver class {$class} not found");
}
return new $class(
$driver = new $class(
containerName: $this->container_name,
containerId: $this->container_id,
serviceId: $this->id,
credentials: $this->credentials
service: $this,
);
if ($driver instanceof DatabaseDriver) {
$driver->credentials = $this->credentials;
}
return $driver;
}
}