static hosting
This commit is contained in:
@@ -33,7 +33,9 @@ class Application extends BaseModel
|
||||
'source_type',
|
||||
'ports_mappings',
|
||||
'ports_exposes',
|
||||
'publish_directory',
|
||||
];
|
||||
|
||||
public function environment()
|
||||
{
|
||||
return $this->belongsTo(Environment::class);
|
||||
@@ -55,6 +57,18 @@ class Application extends BaseModel
|
||||
return $this->morphMany(LocalPersistentVolume::class, 'resource');
|
||||
}
|
||||
|
||||
public function publishDirectory(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn ($value) => $value ? '/' . ltrim($value, '/') : null,
|
||||
);
|
||||
}
|
||||
public function baseDirectory(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: fn ($value) => '/' . ltrim($value, '/'),
|
||||
);
|
||||
}
|
||||
public function portsMappingsArray(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ApplicationSetting extends Model
|
||||
@@ -11,6 +12,20 @@ class ApplicationSetting extends Model
|
||||
'is_git_submodules_allowed',
|
||||
'is_git_lfs_allowed',
|
||||
];
|
||||
public function isStatic(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
set: function ($value) {
|
||||
if ($value) {
|
||||
$this->application->ports_exposes = '80';
|
||||
} else {
|
||||
$this->application->ports_exposes = '3000';
|
||||
}
|
||||
$this->application->save();
|
||||
return $value;
|
||||
}
|
||||
);
|
||||
}
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(Application::class);
|
||||
|
||||
Reference in New Issue
Block a user