Always prefer ::class notation
This commit is contained in:
@@ -23,28 +23,28 @@ class StartDatabase
|
||||
return 'Server is not functional';
|
||||
}
|
||||
switch ($database->getMorphClass()) {
|
||||
case 'App\Models\StandalonePostgresql':
|
||||
case \App\Models\StandalonePostgresql::class:
|
||||
$activity = StartPostgresql::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneRedis':
|
||||
case \App\Models\StandaloneRedis::class:
|
||||
$activity = StartRedis::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneMongodb':
|
||||
case \App\Models\StandaloneMongodb::class:
|
||||
$activity = StartMongodb::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneMysql':
|
||||
case \App\Models\StandaloneMysql::class:
|
||||
$activity = StartMysql::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneMariadb':
|
||||
case \App\Models\StandaloneMariadb::class:
|
||||
$activity = StartMariadb::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneKeydb':
|
||||
case \App\Models\StandaloneKeydb::class:
|
||||
$activity = StartKeydb::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneDragonfly':
|
||||
case \App\Models\StandaloneDragonfly::class:
|
||||
$activity = StartDragonfly::run($database);
|
||||
break;
|
||||
case 'App\Models\StandaloneClickhouse':
|
||||
case \App\Models\StandaloneClickhouse::class:
|
||||
$activity = StartClickhouse::run($database);
|
||||
break;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class StartDatabaseProxy
|
||||
$server = data_get($database, 'destination.server');
|
||||
$containerName = data_get($database, 'uuid');
|
||||
$proxyContainerName = "{$database->uuid}-proxy";
|
||||
if ($database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$databaseType = $database->databaseType();
|
||||
// $connectPredefined = data_get($database, 'service.connect_to_docker_network');
|
||||
$network = $database->service->uuid;
|
||||
@@ -34,54 +34,54 @@ class StartDatabaseProxy
|
||||
$proxyContainerName = "{$database->service->uuid}-proxy";
|
||||
switch ($databaseType) {
|
||||
case 'standalone-mariadb':
|
||||
$type = 'App\Models\StandaloneMariadb';
|
||||
$type = \App\Models\StandaloneMariadb::class;
|
||||
$containerName = "mariadb-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-mongodb':
|
||||
$type = 'App\Models\StandaloneMongodb';
|
||||
$type = \App\Models\StandaloneMongodb::class;
|
||||
$containerName = "mongodb-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-mysql':
|
||||
$type = 'App\Models\StandaloneMysql';
|
||||
$type = \App\Models\StandaloneMysql::class;
|
||||
$containerName = "mysql-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-postgresql':
|
||||
$type = 'App\Models\StandalonePostgresql';
|
||||
$type = \App\Models\StandalonePostgresql::class;
|
||||
$containerName = "postgresql-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-redis':
|
||||
$type = 'App\Models\StandaloneRedis';
|
||||
$type = \App\Models\StandaloneRedis::class;
|
||||
$containerName = "redis-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-keydb':
|
||||
$type = 'App\Models\StandaloneKeydb';
|
||||
$type = \App\Models\StandaloneKeydb::class;
|
||||
$containerName = "keydb-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-dragonfly':
|
||||
$type = 'App\Models\StandaloneDragonfly';
|
||||
$type = \App\Models\StandaloneDragonfly::class;
|
||||
$containerName = "dragonfly-{$database->service->uuid}";
|
||||
break;
|
||||
case 'standalone-clickhouse':
|
||||
$type = 'App\Models\StandaloneClickhouse';
|
||||
$type = \App\Models\StandaloneClickhouse::class;
|
||||
$containerName = "clickhouse-{$database->service->uuid}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($type === 'App\Models\StandaloneRedis') {
|
||||
if ($type === \App\Models\StandaloneRedis::class) {
|
||||
$internalPort = 6379;
|
||||
} elseif ($type === 'App\Models\StandalonePostgresql') {
|
||||
} elseif ($type === \App\Models\StandalonePostgresql::class) {
|
||||
$internalPort = 5432;
|
||||
} elseif ($type === 'App\Models\StandaloneMongodb') {
|
||||
} elseif ($type === \App\Models\StandaloneMongodb::class) {
|
||||
$internalPort = 27017;
|
||||
} elseif ($type === 'App\Models\StandaloneMysql') {
|
||||
} elseif ($type === \App\Models\StandaloneMysql::class) {
|
||||
$internalPort = 3306;
|
||||
} elseif ($type === 'App\Models\StandaloneMariadb') {
|
||||
} elseif ($type === \App\Models\StandaloneMariadb::class) {
|
||||
$internalPort = 3306;
|
||||
} elseif ($type === 'App\Models\StandaloneKeydb') {
|
||||
} elseif ($type === \App\Models\StandaloneKeydb::class) {
|
||||
$internalPort = 6379;
|
||||
} elseif ($type === 'App\Models\StandaloneDragonfly') {
|
||||
} elseif ($type === \App\Models\StandaloneDragonfly::class) {
|
||||
$internalPort = 6379;
|
||||
} elseif ($type === 'App\Models\StandaloneClickhouse') {
|
||||
} elseif ($type === \App\Models\StandaloneClickhouse::class) {
|
||||
$internalPort = 9000;
|
||||
}
|
||||
$configuration_dir = database_proxy_dir($database->uuid);
|
||||
|
@@ -22,7 +22,7 @@ class StopDatabaseProxy
|
||||
{
|
||||
$server = data_get($database, 'destination.server');
|
||||
$uuid = $database->uuid;
|
||||
if ($database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$uuid = $database->service->uuid;
|
||||
$server = data_get($database, 'service.server');
|
||||
}
|
||||
|
@@ -180,7 +180,7 @@ class Init extends Command
|
||||
'save_s3' => false,
|
||||
'frequency' => '0 0 * * *',
|
||||
'database_id' => $database->id,
|
||||
'database_type' => 'App\Models\StandalonePostgresql',
|
||||
'database_type' => \App\Models\StandalonePostgresql::class,
|
||||
'team_id' => 0,
|
||||
]);
|
||||
}
|
||||
|
@@ -292,7 +292,7 @@ class DeployController extends Controller
|
||||
return ['message' => "Resource ($resource) not found.", 'deployment_uuid' => $deployment_uuid];
|
||||
}
|
||||
switch ($resource?->getMorphClass()) {
|
||||
case 'App\Models\Application':
|
||||
case \App\Models\Application::class:
|
||||
$deployment_uuid = new Cuid2;
|
||||
queue_application_deployment(
|
||||
application: $resource,
|
||||
@@ -301,7 +301,7 @@ class DeployController extends Controller
|
||||
);
|
||||
$message = "Application {$resource->name} deployment queued.";
|
||||
break;
|
||||
case 'App\Models\Service':
|
||||
case \App\Models\Service::class:
|
||||
StartService::run($resource);
|
||||
$message = "Service {$resource->name} started. It could take a while, be patient.";
|
||||
break;
|
||||
|
@@ -53,7 +53,7 @@ class ResourcesController extends Controller
|
||||
$resources = $resources->flatten();
|
||||
$resources = $resources->map(function ($resource) {
|
||||
$payload = $resource->toArray();
|
||||
if ($resource->getMorphClass() === 'App\Models\Service') {
|
||||
if ($resource->getMorphClass() === \App\Models\Service::class) {
|
||||
$payload['status'] = $resource->status();
|
||||
} else {
|
||||
$payload['status'] = $resource->status;
|
||||
|
@@ -72,7 +72,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
||||
|
||||
return;
|
||||
}
|
||||
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
||||
if (data_get($this->backup, 'database_type') === \App\Models\ServiceDatabase::class) {
|
||||
$this->database = data_get($this->backup, 'database');
|
||||
$this->server = $this->database->service->server;
|
||||
$this->s3 = $this->backup->s3;
|
||||
@@ -94,7 +94,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
||||
if (! $status->startsWith('running') && $this->database->id !== 0) {
|
||||
return;
|
||||
}
|
||||
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
||||
if (data_get($this->backup, 'database_type') === \App\Models\ServiceDatabase::class) {
|
||||
$databaseType = $this->database->databaseType();
|
||||
$serviceUuid = $this->database->service->uuid;
|
||||
$serviceName = str($this->database->service->name)->slug();
|
||||
@@ -484,7 +484,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
||||
$bucket = $this->s3->bucket;
|
||||
$endpoint = $this->s3->endpoint;
|
||||
$this->s3->testConnection(shouldSave: true);
|
||||
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
||||
if (data_get($this->backup, 'database_type') === \App\Models\ServiceDatabase::class) {
|
||||
$network = $this->database->service->destination->network;
|
||||
} else {
|
||||
$network = $this->database->destination->network;
|
||||
|
@@ -29,7 +29,7 @@ class Form extends Component
|
||||
public function delete()
|
||||
{
|
||||
try {
|
||||
if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') {
|
||||
if ($this->destination->getMorphClass() === \App\Models\StandaloneDocker::class) {
|
||||
if ($this->destination->attachedTo()) {
|
||||
return $this->dispatch('error', 'You must delete all resources before deleting this destination.');
|
||||
}
|
||||
|
@@ -24,10 +24,10 @@ class Index extends Component
|
||||
}
|
||||
// No backups
|
||||
if (
|
||||
$database->getMorphClass() === 'App\Models\StandaloneRedis' ||
|
||||
$database->getMorphClass() === 'App\Models\StandaloneKeydb' ||
|
||||
$database->getMorphClass() === 'App\Models\StandaloneDragonfly' ||
|
||||
$database->getMorphClass() === 'App\Models\StandaloneClickhouse'
|
||||
$database->getMorphClass() === \App\Models\StandaloneRedis::class ||
|
||||
$database->getMorphClass() === \App\Models\StandaloneKeydb::class ||
|
||||
$database->getMorphClass() === \App\Models\StandaloneDragonfly::class ||
|
||||
$database->getMorphClass() === \App\Models\StandaloneClickhouse::class
|
||||
) {
|
||||
return redirect()->route('project.database.configuration', [
|
||||
'project_uuid' => $project->uuid,
|
||||
|
@@ -77,7 +77,7 @@ class BackupEdit extends Component
|
||||
|
||||
$this->backup->delete();
|
||||
|
||||
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($this->backup->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$previousUrl = url()->previous();
|
||||
$url = Url::fromString($previousUrl);
|
||||
$url = $url->withoutQueryParameter('selectedBackupId');
|
||||
@@ -138,7 +138,7 @@ class BackupEdit extends Component
|
||||
$backupFolder = null;
|
||||
|
||||
foreach ($executions as $execution) {
|
||||
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($this->backup->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$server = $this->backup->database->service->destination->server;
|
||||
} else {
|
||||
$server = $this->backup->database->destination->server;
|
||||
|
@@ -57,7 +57,7 @@ class BackupExecutions extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->service->destination->server);
|
||||
} else {
|
||||
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server);
|
||||
|
@@ -66,7 +66,7 @@ class CreateScheduledBackup extends Component
|
||||
}
|
||||
|
||||
$databaseBackup = ScheduledDatabaseBackup::create($payload);
|
||||
if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($this->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$this->dispatch('refreshScheduledBackups', $databaseBackup->id);
|
||||
} else {
|
||||
$this->dispatch('refreshScheduledBackups');
|
||||
|
@@ -77,10 +77,10 @@ class Import extends Component
|
||||
}
|
||||
|
||||
if (
|
||||
$this->resource->getMorphClass() == 'App\Models\StandaloneRedis' ||
|
||||
$this->resource->getMorphClass() == 'App\Models\StandaloneKeydb' ||
|
||||
$this->resource->getMorphClass() == 'App\Models\StandaloneDragonfly' ||
|
||||
$this->resource->getMorphClass() == 'App\Models\StandaloneClickhouse'
|
||||
$this->resource->getMorphClass() == \App\Models\StandaloneRedis::class ||
|
||||
$this->resource->getMorphClass() == \App\Models\StandaloneKeydb::class ||
|
||||
$this->resource->getMorphClass() == \App\Models\StandaloneDragonfly::class ||
|
||||
$this->resource->getMorphClass() == \App\Models\StandaloneClickhouse::class
|
||||
) {
|
||||
$this->unsupported = true;
|
||||
}
|
||||
@@ -108,19 +108,19 @@ class Import extends Component
|
||||
$this->importCommands[] = "docker cp {$tmpPath} {$this->container}:{$tmpPath}";
|
||||
|
||||
switch ($this->resource->getMorphClass()) {
|
||||
case 'App\Models\StandaloneMariadb':
|
||||
case \App\Models\StandaloneMariadb::class:
|
||||
$this->importCommands[] = "docker exec {$this->container} sh -c '{$this->mariadbRestoreCommand} < {$tmpPath}'";
|
||||
$this->importCommands[] = "rm {$tmpPath}";
|
||||
break;
|
||||
case 'App\Models\StandaloneMysql':
|
||||
case \App\Models\StandaloneMysql::class:
|
||||
$this->importCommands[] = "docker exec {$this->container} sh -c '{$this->mysqlRestoreCommand} < {$tmpPath}'";
|
||||
$this->importCommands[] = "rm {$tmpPath}";
|
||||
break;
|
||||
case 'App\Models\StandalonePostgresql':
|
||||
case \App\Models\StandalonePostgresql::class:
|
||||
$this->importCommands[] = "docker exec {$this->container} sh -c '{$this->postgresqlRestoreCommand} {$tmpPath}'";
|
||||
$this->importCommands[] = "rm {$tmpPath}";
|
||||
break;
|
||||
case 'App\Models\StandaloneMongodb':
|
||||
case \App\Models\StandaloneMongodb::class:
|
||||
$this->importCommands[] = "docker exec {$this->container} sh -c '{$this->mongodbRestoreCommand}{$tmpPath}'";
|
||||
$this->importCommands[] = "rm {$tmpPath}";
|
||||
break;
|
||||
|
@@ -29,7 +29,7 @@ class ScheduledBackups extends Component
|
||||
$this->setSelectedBackup($this->selectedBackupId, true);
|
||||
}
|
||||
$this->parameters = get_route_parameters();
|
||||
if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($this->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$this->type = 'service-database';
|
||||
} else {
|
||||
$this->type = 'database';
|
||||
|
@@ -213,7 +213,7 @@ class PublicGitRepository extends Component
|
||||
|
||||
return;
|
||||
}
|
||||
if ($this->git_source->getMorphClass() === 'App\Models\GithubApp') {
|
||||
if ($this->git_source->getMorphClass() === \App\Models\GithubApp::class) {
|
||||
['rate_limit_remaining' => $this->rate_limit_remaining, 'rate_limit_reset' => $this->rate_limit_reset] = githubApi(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches/{$this->git_branch}");
|
||||
$this->rate_limit_reset = Carbon::parse((int) $this->rate_limit_reset)->format('Y-M-d H:i:s');
|
||||
$this->branchFound = true;
|
||||
|
@@ -35,7 +35,7 @@ class All extends Component
|
||||
public function mount()
|
||||
{
|
||||
$this->resourceClass = get_class($this->resource);
|
||||
$resourceWithPreviews = ['App\Models\Application'];
|
||||
$resourceWithPreviews = [\App\Models\Application::class];
|
||||
$simpleDockerfile = ! is_null(data_get($this->resource, 'dockerfile'));
|
||||
if (str($this->resourceClass)->contains($resourceWithPreviews) && ! $simpleDockerfile) {
|
||||
$this->showPreview = true;
|
||||
|
@@ -58,7 +58,7 @@ class Show extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if ($this->env->getMorphClass() === 'App\Models\SharedEnvironmentVariable') {
|
||||
if ($this->env->getMorphClass() === \App\Models\SharedEnvironmentVariable::class) {
|
||||
$this->isSharedVariable = true;
|
||||
}
|
||||
$this->modalId = new Cuid2;
|
||||
@@ -80,7 +80,7 @@ class Show extends Component
|
||||
public function serialize()
|
||||
{
|
||||
data_forget($this->env, 'real_value');
|
||||
if ($this->env->getMorphClass() === 'App\Models\SharedEnvironmentVariable') {
|
||||
if ($this->env->getMorphClass() === \App\Models\SharedEnvironmentVariable::class) {
|
||||
data_forget($this->env, 'is_build_time');
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ class GetLogs extends Component
|
||||
public function mount()
|
||||
{
|
||||
if (! is_null($this->resource)) {
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
if ($this->resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$this->showTimeStamps = $this->resource->settings->is_include_timestamps;
|
||||
} else {
|
||||
if ($this->servicesubtype) {
|
||||
@@ -53,7 +53,7 @@ class GetLogs extends Component
|
||||
$this->showTimeStamps = $this->resource->is_include_timestamps;
|
||||
}
|
||||
}
|
||||
if ($this->resource?->getMorphClass() === 'App\Models\Application') {
|
||||
if ($this->resource?->getMorphClass() === \App\Models\Application::class) {
|
||||
if (str($this->container)->contains('-pr-')) {
|
||||
$this->pull_request = 'Pull Request: '.str($this->container)->afterLast('-pr-')->beforeLast('_')->value();
|
||||
}
|
||||
@@ -69,11 +69,11 @@ class GetLogs extends Component
|
||||
public function instantSave()
|
||||
{
|
||||
if (! is_null($this->resource)) {
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
if ($this->resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$this->resource->settings->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->resource->settings->save();
|
||||
}
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Service') {
|
||||
if ($this->resource->getMorphClass() === \App\Models\Service::class) {
|
||||
$serviceName = str($this->container)->beforeLast('-')->value();
|
||||
$subType = $this->resource->applications()->where('name', $serviceName)->first();
|
||||
if ($subType) {
|
||||
@@ -95,7 +95,7 @@ class GetLogs extends Component
|
||||
if (! $this->server->isFunctional()) {
|
||||
return;
|
||||
}
|
||||
if (! $refresh && ($this->resource?->getMorphClass() === 'App\Models\Service' || str($this->container)->contains('-pr-'))) {
|
||||
if (! $refresh && ($this->resource?->getMorphClass() === \App\Models\Service::class || str($this->container)->contains('-pr-'))) {
|
||||
return;
|
||||
}
|
||||
if ($this->numberOfLines <= 0 || is_null($this->numberOfLines)) {
|
||||
|
@@ -41,7 +41,7 @@ class ResourceOperations extends Component
|
||||
}
|
||||
$uuid = (string) new Cuid2;
|
||||
$server = $new_destination->server;
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
if ($this->resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$new_resource = $this->resource->replicate()->fill([
|
||||
'uuid' => $uuid,
|
||||
'name' => $this->resource->name.'-clone-'.$uuid,
|
||||
@@ -78,14 +78,14 @@ class ResourceOperations extends Component
|
||||
|
||||
return redirect()->to($route);
|
||||
} elseif (
|
||||
$this->resource->getMorphClass() === 'App\Models\StandalonePostgresql' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneMongodb' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneMysql' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneMariadb' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneRedis' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneKeydb' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneDragonfly' ||
|
||||
$this->resource->getMorphClass() === 'App\Models\StandaloneClickhouse'
|
||||
$this->resource->getMorphClass() === \App\Models\StandalonePostgresql::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneMongodb::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneMysql::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneMariadb::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneRedis::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneKeydb::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneDragonfly::class ||
|
||||
$this->resource->getMorphClass() === \App\Models\StandaloneClickhouse::class
|
||||
) {
|
||||
$uuid = (string) new Cuid2;
|
||||
$new_resource = $this->resource->replicate()->fill([
|
||||
|
@@ -83,7 +83,7 @@ class Add extends Component
|
||||
]);
|
||||
$this->file_storage_path = trim($this->file_storage_path);
|
||||
$this->file_storage_path = str($this->file_storage_path)->start('/')->value();
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
if ($this->resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$fs_path = application_configuration_dir().'/'.$this->resource->uuid.$this->file_storage_path;
|
||||
}
|
||||
LocalFileVolume::create(
|
||||
|
@@ -84,7 +84,7 @@ class SettingsBackup extends Component
|
||||
'postgres_password' => $postgres_password,
|
||||
'postgres_db' => $postgres_db,
|
||||
'status' => 'running',
|
||||
'destination_type' => 'App\Models\StandaloneDocker',
|
||||
'destination_type' => \App\Models\StandaloneDocker::class,
|
||||
'destination_id' => 0,
|
||||
]);
|
||||
$this->backup = ScheduledDatabaseBackup::create([
|
||||
@@ -93,7 +93,7 @@ class SettingsBackup extends Component
|
||||
'save_s3' => false,
|
||||
'frequency' => '0 0 * * *',
|
||||
'database_id' => $this->database->id,
|
||||
'database_type' => 'App\Models\StandalonePostgresql',
|
||||
'database_type' => \App\Models\StandalonePostgresql::class,
|
||||
'team_id' => currentTeam()->id,
|
||||
]);
|
||||
$this->database->refresh();
|
||||
|
@@ -936,7 +936,7 @@ class Application extends BaseModel
|
||||
$source_html_url_host = $url['host'];
|
||||
$source_html_url_scheme = $url['scheme'];
|
||||
|
||||
if ($this->source->getMorphClass() == 'App\Models\GithubApp') {
|
||||
if ($this->source->getMorphClass() == \App\Models\GithubApp::class) {
|
||||
if ($this->source->is_public) {
|
||||
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
|
||||
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
|
||||
|
@@ -65,7 +65,7 @@ class GithubApp extends BaseModel
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function () {
|
||||
if ($this->getMorphClass() === 'App\Models\GithubApp') {
|
||||
if ($this->getMorphClass() === \App\Models\GithubApp::class) {
|
||||
return 'github';
|
||||
}
|
||||
},
|
||||
|
@@ -52,7 +52,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue
|
||||
$channels = setNotificationChannels($notifiable, 'deployments');
|
||||
if (isCloud()) {
|
||||
// TODO: Make batch notifications work with email
|
||||
$channels = array_diff($channels, ['App\Notifications\Channels\EmailChannel']);
|
||||
$channels = array_diff($channels, [\App\Notifications\Channels\EmailChannel::class]);
|
||||
}
|
||||
|
||||
return $channels;
|
||||
|
@@ -18,23 +18,23 @@ class TelegramChannel
|
||||
$topicsInstance = get_class($notification);
|
||||
|
||||
switch ($topicsInstance) {
|
||||
case 'App\Notifications\Test':
|
||||
case \App\Notifications\Test::class:
|
||||
$topicId = data_get($notifiable, 'telegram_notifications_test_message_thread_id');
|
||||
break;
|
||||
case 'App\Notifications\Application\StatusChanged':
|
||||
case 'App\Notifications\Container\ContainerRestarted':
|
||||
case 'App\Notifications\Container\ContainerStopped':
|
||||
case \App\Notifications\Application\StatusChanged::class:
|
||||
case \App\Notifications\Container\ContainerRestarted::class:
|
||||
case \App\Notifications\Container\ContainerStopped::class:
|
||||
$topicId = data_get($notifiable, 'telegram_notifications_status_changes_message_thread_id');
|
||||
break;
|
||||
case 'App\Notifications\Application\DeploymentSuccess':
|
||||
case 'App\Notifications\Application\DeploymentFailed':
|
||||
case \App\Notifications\Application\DeploymentSuccess::class:
|
||||
case \App\Notifications\Application\DeploymentFailed::class:
|
||||
$topicId = data_get($notifiable, 'telegram_notifications_deployments_message_thread_id');
|
||||
break;
|
||||
case 'App\Notifications\Database\BackupSuccess':
|
||||
case 'App\Notifications\Database\BackupFailed':
|
||||
case \App\Notifications\Database\BackupSuccess::class:
|
||||
case \App\Notifications\Database\BackupFailed::class:
|
||||
$topicId = data_get($notifiable, 'telegram_notifications_database_backups_message_thread_id');
|
||||
break;
|
||||
case 'App\Notifications\ScheduledTask\TaskFailed':
|
||||
case \App\Notifications\ScheduledTask\TaskFailed::class:
|
||||
$topicId = data_get($notifiable, 'telegram_notifications_scheduled_tasks_thread_id');
|
||||
break;
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ class Test extends Notification implements ShouldQueue
|
||||
public function middleware(object $notifiable, string $channel)
|
||||
{
|
||||
return match ($channel) {
|
||||
'App\Notifications\Channels\EmailChannel' => [new RateLimited('email')],
|
||||
\App\Notifications\Channels\EmailChannel::class => [new RateLimited('email')],
|
||||
default => [],
|
||||
};
|
||||
}
|
||||
|
@@ -207,12 +207,12 @@ function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'applica
|
||||
}
|
||||
function generateServiceSpecificFqdns(ServiceApplication|Application $resource)
|
||||
{
|
||||
if ($resource->getMorphClass() === 'App\Models\ServiceApplication') {
|
||||
if ($resource->getMorphClass() === \App\Models\ServiceApplication::class) {
|
||||
$uuid = data_get($resource, 'uuid');
|
||||
$server = data_get($resource, 'service.server');
|
||||
$environment_variables = data_get($resource, 'service.environment_variables');
|
||||
$type = $resource->serviceType();
|
||||
} elseif ($resource->getMorphClass() === 'App\Models\Application') {
|
||||
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$uuid = data_get($resource, 'uuid');
|
||||
$server = data_get($resource, 'destination.server');
|
||||
$environment_variables = data_get($resource, 'environment_variables');
|
||||
|
@@ -57,7 +57,7 @@ function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $m
|
||||
if (is_null($source)) {
|
||||
throw new \Exception('Not implemented yet.');
|
||||
}
|
||||
if ($source->getMorphClass() == 'App\Models\GithubApp') {
|
||||
if ($source->getMorphClass() == \App\Models\GithubApp::class) {
|
||||
if ($source->is_public) {
|
||||
$response = Http::github($source->api_url)->$method($endpoint);
|
||||
} else {
|
||||
|
@@ -24,7 +24,7 @@ function replaceVariables(string $variable): Stringable
|
||||
function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Application $oneService, bool $isInit = false)
|
||||
{
|
||||
try {
|
||||
if ($oneService->getMorphClass() === 'App\Models\Application') {
|
||||
if ($oneService->getMorphClass() === \App\Models\Application::class) {
|
||||
$workdir = $oneService->workdir();
|
||||
$server = $oneService->destination->server;
|
||||
} else {
|
||||
|
@@ -669,7 +669,7 @@ function generateGitManualWebhook($resource, $type)
|
||||
if ($resource->source_id !== 0 && ! is_null($resource->source_id)) {
|
||||
return null;
|
||||
}
|
||||
if ($resource->getMorphClass() === 'App\Models\Application') {
|
||||
if ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||
$baseUrl = base_url();
|
||||
$api = Url::fromString($baseUrl)."/webhooks/source/$type/events/manual";
|
||||
|
||||
@@ -685,7 +685,7 @@ function removeAnsiColors($text)
|
||||
|
||||
function getTopLevelNetworks(Service|Application $resource)
|
||||
{
|
||||
if ($resource->getMorphClass() === 'App\Models\Service') {
|
||||
if ($resource->getMorphClass() === \App\Models\Service::class) {
|
||||
if ($resource->docker_compose_raw) {
|
||||
try {
|
||||
$yaml = Yaml::parse($resource->docker_compose_raw);
|
||||
@@ -740,7 +740,7 @@ function getTopLevelNetworks(Service|Application $resource)
|
||||
|
||||
return $topLevelNetworks->keys();
|
||||
}
|
||||
} elseif ($resource->getMorphClass() === 'App\Models\Application') {
|
||||
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||
try {
|
||||
$yaml = Yaml::parse($resource->docker_compose_raw);
|
||||
} catch (\Exception $e) {
|
||||
@@ -1147,7 +1147,7 @@ function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId =
|
||||
function check_domain_usage(ServiceApplication|Application|null $resource = null, ?string $domain = null)
|
||||
{
|
||||
if ($resource) {
|
||||
if ($resource->getMorphClass() === 'App\Models\Application' && $resource->build_pack === 'dockercompose') {
|
||||
if ($resource->getMorphClass() === \App\Models\Application::class && $resource->build_pack === 'dockercompose') {
|
||||
$domains = data_get(json_decode($resource->docker_compose_domains, true), '*.domain');
|
||||
$domains = collect($domains);
|
||||
} else {
|
||||
@@ -1411,7 +1411,7 @@ function parseServiceVolumes($serviceVolumes, $resource, $topLevelVolumes, $pull
|
||||
if ($source->value() === '/tmp' || $source->value() === '/tmp/') {
|
||||
return $volume;
|
||||
}
|
||||
if (get_class($resource) === "App\Models\Application") {
|
||||
if (get_class($resource) === \App\Models\Application::class) {
|
||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||
} else {
|
||||
$dir = base_configuration_dir().'/services/'.$resource->service->uuid;
|
||||
@@ -1451,7 +1451,7 @@ function parseServiceVolumes($serviceVolumes, $resource, $topLevelVolumes, $pull
|
||||
}
|
||||
}
|
||||
$slugWithoutUuid = Str::slug($source, '-');
|
||||
if (get_class($resource) === "App\Models\Application") {
|
||||
if (get_class($resource) === \App\Models\Application::class) {
|
||||
$name = "{$resource->uuid}_{$slugWithoutUuid}";
|
||||
} else {
|
||||
$name = "{$resource->service->uuid}_{$slugWithoutUuid}";
|
||||
@@ -1494,7 +1494,7 @@ function parseServiceVolumes($serviceVolumes, $resource, $topLevelVolumes, $pull
|
||||
|
||||
function parseDockerComposeFile(Service|Application $resource, bool $isNew = false, int $pull_request_id = 0, ?int $preview_id = null)
|
||||
{
|
||||
if ($resource->getMorphClass() === 'App\Models\Service') {
|
||||
if ($resource->getMorphClass() === \App\Models\Service::class) {
|
||||
if ($resource->docker_compose_raw) {
|
||||
try {
|
||||
$yaml = Yaml::parse($resource->docker_compose_raw);
|
||||
@@ -2208,7 +2208,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
} else {
|
||||
return collect([]);
|
||||
}
|
||||
} elseif ($resource->getMorphClass() === 'App\Models\Application') {
|
||||
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||
try {
|
||||
$yaml = Yaml::parse($resource->docker_compose_raw);
|
||||
} catch (\Exception $e) {
|
||||
@@ -3094,7 +3094,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
||||
}
|
||||
}
|
||||
|
||||
if ($value && get_class($value) === 'Illuminate\Support\Stringable' && $value->startsWith('/')) {
|
||||
if ($value && get_class($value) === \Illuminate\Support\Stringable::class && $value->startsWith('/')) {
|
||||
$path = $value->value();
|
||||
if ($path !== '/') {
|
||||
$fqdn = "$fqdn$path";
|
||||
|
@@ -264,7 +264,7 @@ Route::middleware(['auth'])->group(function () {
|
||||
}
|
||||
}
|
||||
$filename = data_get($execution, 'filename');
|
||||
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === \App\Models\ServiceDatabase::class) {
|
||||
$server = $execution->scheduledDatabaseBackup->database->service->destination->server;
|
||||
} else {
|
||||
$server = $execution->scheduledDatabaseBackup->database->destination->server;
|
||||
|
Reference in New Issue
Block a user