mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-13 18:15:24 +00:00
Merge remote-tracking branch 'origin/next' into feature/vultr-cloud-provider
This commit is contained in:
commit
31f904ef9f
35 files changed
+7215
-113
No files matched your search
@@ -47,6 +47,11 @@ class Environment extends BaseModel
|
||||
return Environment::whereRelation('project.team', 'id', currentTeam()->id)->orderBy('name');
|
||||
}
|
||||
|
||||
public static function ownedByCurrentTeamAPI(int $teamId)
|
||||
{
|
||||
return Environment::whereRelation('project.team', 'id', $teamId)->orderBy('name');
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->applications()->count() == 0 &&
|
||||
|
||||
@@ -3,7 +3,19 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\HasSafeStringAttribute;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use OpenApi\Attributes as OA;
|
||||
|
||||
#[OA\Schema(
|
||||
description: 'Tag model',
|
||||
type: 'object',
|
||||
properties: [
|
||||
new OA\Property(property: 'uuid', type: 'string'),
|
||||
new OA\Property(property: 'name', type: 'string'),
|
||||
new OA\Property(property: 'created_at', type: 'string'),
|
||||
new OA\Property(property: 'updated_at', type: 'string'),
|
||||
]
|
||||
)]
|
||||
class Tag extends BaseModel
|
||||
{
|
||||
use HasSafeStringAttribute;
|
||||
@@ -23,6 +35,13 @@ class Tag extends BaseModel
|
||||
return Tag::whereTeamId(currentTeam()->id)->orderBy('name');
|
||||
}
|
||||
|
||||
public function deleteIfOrphaned(): void
|
||||
{
|
||||
if (DB::table('taggables')->where('tag_id', $this->id)->doesntExist()) {
|
||||
$this->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function applications()
|
||||
{
|
||||
return $this->morphedByMany(Application::class, 'taggable');
|
||||
|
||||
Reference in new issue
Block a user