coolify/app/Models/ApplicationSetting.php

52 lines
1.5 KiB
PHP
Raw Normal View History

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
{
protected $casts = [
2023-05-31 09:24:02 +00:00
'is_static' => 'boolean',
'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',
'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',
'is_pr_deployments_public_enabled' => 'boolean',
2023-05-31 09:24:02 +00:00
'is_git_submodules_enabled' => 'boolean',
'is_git_lfs_enabled' => 'boolean',
'is_git_shallow_clone_enabled' => 'boolean',
'docker_images_to_keep' => 'integer',
2023-05-31 09:24:02 +00:00
];
2024-06-10 20:43:34 +00:00
2023-12-06 20:32:23 +00:00
protected $guarded = [];
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;
}
);
}
public function application()
{
return $this->belongsTo(Application::class);
}
2023-03-28 13:47:37 +00:00
}