An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Always prefer ::class notation
Lucas Michotc5403b0b3f71
diff --git a/app/Actions/Database/StartDatabase.php b/app/Actions/Database/StartDatabase.phpindex 323c52ff93..73b2f9ac09 100644--- a/app/Actions/Database/StartDatabase.php+++ b/app/Actions/Database/StartDatabase.php@@ -23,28 +23,28 @@ class StartDatabasereturn '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;}diff --git a/app/Actions/Database/StartDatabaseProxy.php b/app/Actions/Database/StartDatabaseProxy.phpindex a514c51b49..d7a3bc697a 100644--- a/app/Actions/Database/StartDatabaseProxy.php+++ b/app/Actions/Database/StartDatabaseProxy.php@@ -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);diff --git a/app/Actions/Database/StopDatabaseProxy.php b/app/Actions/Database/StopDatabaseProxy.phpindex b2092e2ef4..9e9a621700 100644--- a/app/Actions/Database/StopDatabaseProxy.php+++ b/app/Actions/Database/StopDatabaseProxy.php@@ -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');}diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.phpindex 891d1b5382..8f68966a55 100644--- a/app/Console/Commands/Init.php+++ b/app/Console/Commands/Init.php@@ -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,]);}diff --git a/app/Http/Controllers/Api/DeployController.php b/app/Http/Controllers/Api/DeployController.phpindex d1c8f5ea62..666dc55a53 100644--- a/app/Http/Controllers/Api/DeployController.php+++ b/app/Http/Controllers/Api/DeployController.php@@ -292,7 +292,7 @@ class DeployController extends Controllerreturn ['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;diff --git a/app/Http/Controllers/Api/ResourcesController.php b/app/Http/Controllers/Api/ResourcesController.phpindex 1fd5792e03..4180cef9a1 100644--- a/app/Http/Controllers/Api/ResourcesController.php+++ b/app/Http/Controllers/Api/ResourcesController.php@@ -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;diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.phpindex d38a1570f8..196af2a83b 100644--- a/app/Jobs/DatabaseBackupJob.php+++ b/app/Jobs/DatabaseBackupJob.php@@ -72,7 +72,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueuereturn;}- 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, ShouldQueueif (! $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;diff --git a/app/Livewire/Destination/Form.php b/app/Livewire/Destination/Form.phpindex 87ae839313..a1a0a7b944 100644--- a/app/Livewire/Destination/Form.php+++ b/app/Livewire/Destination/Form.php@@ -29,7 +29,7 @@ class Form extends Componentpublic 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.');}diff --git a/app/Livewire/Project/Database/Backup/Index.php b/app/Livewire/Project/Database/Backup/Index.phpindex d9a4b623d0..9ff2f48d5f 100644--- a/app/Livewire/Project/Database/Backup/Index.php+++ b/app/Livewire/Project/Database/Backup/Index.php@@ -24,10 +24,10 @@ class Index extends Component}// No backupsif (- $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,diff --git a/app/Livewire/Project/Database/BackupEdit.php b/app/Livewire/Project/Database/BackupEdit.phpindex 016218b789..8d838ed3b1 100644--- a/app/Livewire/Project/Database/BackupEdit.php+++ b/app/Livewire/Project/Database/BackupEdit.php@@ -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;diff --git a/app/Livewire/Project/Database/BackupExecutions.php b/app/Livewire/Project/Database/BackupExecutions.phpindex d7ac180978..45c7c30e20 100644--- a/app/Livewire/Project/Database/BackupExecutions.php+++ b/app/Livewire/Project/Database/BackupExecutions.php@@ -57,7 +57,7 @@ class BackupExecutions extends Componentreturn;}- 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);diff --git a/app/Livewire/Project/Database/CreateScheduledBackup.php b/app/Livewire/Project/Database/CreateScheduledBackup.phpindex 5ed74a6c32..52bced44fa 100644--- a/app/Livewire/Project/Database/CreateScheduledBackup.php+++ b/app/Livewire/Project/Database/CreateScheduledBackup.php@@ -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');diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.phpindex dfaa4461b9..cd9818b417 100644--- a/app/Livewire/Project/Database/Import.php+++ b/app/Livewire/Project/Database/Import.php@@ -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;diff --git a/app/Livewire/Project/Database/ScheduledBackups.php b/app/Livewire/Project/Database/ScheduledBackups.phpindex 8021e25d32..412240bd4e 100644--- a/app/Livewire/Project/Database/ScheduledBackups.php+++ b/app/Livewire/Project/Database/ScheduledBackups.php@@ -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';diff --git a/app/Livewire/Project/New/PublicGitRepository.php b/app/Livewire/Project/New/PublicGitRepository.phpindex a6601a898b..55eb5c77d8 100644--- a/app/Livewire/Project/New/PublicGitRepository.php+++ b/app/Livewire/Project/New/PublicGitRepository.php@@ -213,7 +213,7 @@ class PublicGitRepository extends Componentreturn;}- 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;diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.phpindex 5a711259b2..787d33a690 100644--- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php+++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php@@ -35,7 +35,7 @@ class All extends Componentpublic 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;diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.phpindex 53c4374dfc..e71cd9f42a 100644--- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php+++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php@@ -58,7 +58,7 @@ class Show extends Componentpublic 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 Componentpublic 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');}}diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.phpindex f3d9da07d0..43fd97c341 100644--- a/app/Livewire/Project/Shared/GetLogs.php+++ b/app/Livewire/Project/Shared/GetLogs.php@@ -44,7 +44,7 @@ class GetLogs extends Componentpublic 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 Componentpublic 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 Componentif (! $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)) {diff --git a/app/Livewire/Project/Shared/ResourceOperations.php b/app/Livewire/Project/Shared/ResourceOperations.phpindex ec09eb80fa..414ebba03b 100644--- a/app/Livewire/Project/Shared/ResourceOperations.php+++ b/app/Livewire/Project/Shared/ResourceOperations.php@@ -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 Componentreturn 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([diff --git a/app/Livewire/Project/Shared/Storages/Add.php b/app/Livewire/Project/Shared/Storages/Add.phpindex 27e0c6e447..afa27a6bde 100644--- a/app/Livewire/Project/Shared/Storages/Add.php+++ b/app/Livewire/Project/Shared/Storages/Add.php@@ -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(diff --git a/app/Livewire/SettingsBackup.php b/app/Livewire/SettingsBackup.phpindex 47423a3f99..38f7e548aa 100644--- a/app/Livewire/SettingsBackup.php+++ b/app/Livewire/SettingsBackup.php@@ -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();diff --git a/app/Models/Application.php b/app/Models/Application.phpindex 62a4318ade..c747c75c56 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -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}";diff --git a/app/Models/GithubApp.php b/app/Models/GithubApp.phpindex b9564e02cd..0b0e93b128 100644--- a/app/Models/GithubApp.php+++ b/app/Models/GithubApp.php@@ -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';}},diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.phpindex a2674ad76b..946a622ca5 100644--- a/app/Notifications/Application/DeploymentSuccess.php+++ b/app/Notifications/Application/DeploymentSuccess.php@@ -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;diff --git a/app/Notifications/Channels/TelegramChannel.php b/app/Notifications/Channels/TelegramChannel.phpindex b1a6076513..4b1fa49ddb 100644--- a/app/Notifications/Channels/TelegramChannel.php+++ b/app/Notifications/Channels/TelegramChannel.php@@ -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;}diff --git a/app/Notifications/Test.php b/app/Notifications/Test.phpindex 4c069ffd60..a43b1e1533 100644--- a/app/Notifications/Test.php+++ b/app/Notifications/Test.php@@ -25,7 +25,7 @@ class Test extends Notification implements ShouldQueuepublic 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 => [],};}diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.phpindex 5b45f666f1..2795ae295c 100644--- a/bootstrap/helpers/docker.php+++ b/bootstrap/helpers/docker.php@@ -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');diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.phpindex 97deb0b1c8..0b5f7034b0 100644--- a/bootstrap/helpers/github.php+++ b/bootstrap/helpers/github.php@@ -57,7 +57,7 @@ function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $mif (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 {diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.phpindex eba88d0002..94c3c5f45e 100644--- a/bootstrap/helpers/services.php+++ b/bootstrap/helpers/services.php@@ -24,7 +24,7 @@ function replaceVariables(string $variable): Stringablefunction 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 {diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex dbab6861d4..f92cd5a73b 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -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, $pullif ($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, $pullfunction 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";diff --git a/routes/web.php b/routes/web.phpindex 642131a92b..b9976a0883 100644--- a/routes/web.php+++ b/routes/web.php@@ -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;