2023-03-28 13:47:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2023-04-26 11:01:09 +00:00
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
2023-03-28 13:47:37 +00:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class ApplicationSetting extends Model
|
|
|
|
|
{
|
2025-11-04 07:43:33 +00:00
|
|
|
protected $casts = [
|
2023-05-31 09:24:02 +00:00
|
|
|
'is_static' => 'boolean',
|
2025-11-04 07:43:33 +00:00
|
|
|
'is_spa' => 'boolean',
|
|
|
|
|
'is_build_server_enabled' => 'boolean',
|
|
|
|
|
'is_preserve_repository_enabled' => 'boolean',
|
|
|
|
|
'is_container_label_escape_enabled' => 'boolean',
|
|
|
|
|
'is_container_label_readonly_enabled' => 'boolean',
|
|
|
|
|
'use_build_secrets' => 'boolean',
|
2025-11-26 12:42:02 +00:00
|
|
|
'inject_build_args_to_dockerfile' => 'boolean',
|
|
|
|
|
'include_source_commit_in_build' => 'boolean',
|
2023-05-31 09:24:02 +00:00
|
|
|
'is_auto_deploy_enabled' => 'boolean',
|
|
|
|
|
'is_force_https_enabled' => 'boolean',
|
|
|
|
|
'is_debug_enabled' => 'boolean',
|
|
|
|
|
'is_preview_deployments_enabled' => 'boolean',
|
2025-09-05 12:30:51 +00:00
|
|
|
'is_pr_deployments_public_enabled' => 'boolean',
|
2023-05-31 09:24:02 +00:00
|
|
|
'is_git_submodules_enabled' => 'boolean',
|
|
|
|
|
'is_git_lfs_enabled' => 'boolean',
|
2025-08-21 08:16:57 +00:00
|
|
|
'is_git_shallow_clone_enabled' => 'boolean',
|
2025-12-05 10:02:07 +00:00
|
|
|
'docker_images_to_keep' => 'integer',
|
2023-05-31 09:24:02 +00:00
|
|
|
];
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2026-03-29 19:25:41 +00:00
|
|
|
protected $fillable = [
|
2026-03-31 11:45:31 +00:00
|
|
|
'application_id',
|
2026-03-29 19:25:41 +00:00
|
|
|
'is_static',
|
|
|
|
|
'is_git_submodules_enabled',
|
|
|
|
|
'is_git_lfs_enabled',
|
|
|
|
|
'is_auto_deploy_enabled',
|
|
|
|
|
'is_force_https_enabled',
|
|
|
|
|
'is_debug_enabled',
|
|
|
|
|
'is_preview_deployments_enabled',
|
|
|
|
|
'is_log_drain_enabled',
|
|
|
|
|
'is_gpu_enabled',
|
|
|
|
|
'gpu_driver',
|
|
|
|
|
'gpu_count',
|
|
|
|
|
'gpu_device_ids',
|
|
|
|
|
'gpu_options',
|
|
|
|
|
'is_include_timestamps',
|
|
|
|
|
'is_swarm_only_worker_nodes',
|
|
|
|
|
'is_raw_compose_deployment_enabled',
|
|
|
|
|
'is_build_server_enabled',
|
|
|
|
|
'is_consistent_container_name_enabled',
|
|
|
|
|
'is_gzip_enabled',
|
|
|
|
|
'is_stripprefix_enabled',
|
|
|
|
|
'connect_to_docker_network',
|
|
|
|
|
'custom_internal_name',
|
|
|
|
|
'is_container_label_escape_enabled',
|
|
|
|
|
'is_env_sorting_enabled',
|
|
|
|
|
'is_container_label_readonly_enabled',
|
|
|
|
|
'is_preserve_repository_enabled',
|
|
|
|
|
'disable_build_cache',
|
|
|
|
|
'is_spa',
|
|
|
|
|
'is_git_shallow_clone_enabled',
|
|
|
|
|
'is_pr_deployments_public_enabled',
|
|
|
|
|
'use_build_secrets',
|
|
|
|
|
'inject_build_args_to_dockerfile',
|
|
|
|
|
'include_source_commit_in_build',
|
|
|
|
|
'docker_images_to_keep',
|
|
|
|
|
];
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-04-26 11:01:09 +00:00
|
|
|
public function isStatic(): Attribute
|
|
|
|
|
{
|
|
|
|
|
return Attribute::make(
|
|
|
|
|
set: function ($value) {
|
2023-12-06 20:32:23 +00:00
|
|
|
if ($value) {
|
|
|
|
|
$this->application->ports_exposes = 80;
|
2023-04-26 11:01:09 +00:00
|
|
|
}
|
2023-12-06 20:32:23 +00:00
|
|
|
$this->application->save();
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-04-26 11:01:09 +00:00
|
|
|
return $value;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-03-30 09:09:39 +00:00
|
|
|
public function application()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Application::class);
|
|
|
|
|
}
|
2023-03-28 13:47:37 +00:00
|
|
|
}
|