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
|
|
|
|
{
|
2023-04-19 12:00:31 +00:00
|
|
|
protected $fillable = [
|
2023-04-25 12:43:35 +00:00
|
|
|
'application_id',
|
2023-04-19 12:00:31 +00:00
|
|
|
'is_git_submodules_allowed',
|
|
|
|
'is_git_lfs_allowed',
|
|
|
|
];
|
2023-04-26 11:01:09 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2023-03-30 09:09:39 +00:00
|
|
|
public function application()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Application::class);
|
|
|
|
}
|
2023-03-28 13:47:37 +00:00
|
|
|
}
|