mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: rosslh <ross@rosshill.ca>
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\Auditable;
|
|
use App\Traits\HasSafeStringAttribute;
|
|
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 Auditable, HasSafeStringAttribute;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'team_id',
|
|
];
|
|
|
|
protected function customizeName($value)
|
|
{
|
|
return strtolower($value);
|
|
}
|
|
|
|
public static function ownedByCurrentTeam()
|
|
{
|
|
return Tag::whereTeamId(currentTeam()->id)->orderBy('name');
|
|
}
|
|
|
|
public function applications()
|
|
{
|
|
return $this->morphedByMany(Application::class, 'taggable');
|
|
}
|
|
|
|
public function services()
|
|
{
|
|
return $this->morphedByMany(Service::class, 'taggable');
|
|
}
|
|
}
|