coolify/app/Models/Tag.php

33 lines
613 B
PHP
Raw Permalink Normal View History

2024-02-01 14:38:12 +00:00
<?php
namespace App\Models;
use App\Traits\HasSafeStringAttribute;
2024-02-01 14:38:12 +00:00
class Tag extends BaseModel
{
use HasSafeStringAttribute;
2024-02-01 14:38:12 +00:00
protected $guarded = [];
protected function customizeName($value)
2024-02-01 14:38:12 +00:00
{
return strtolower($value);
2024-02-01 14:38:12 +00:00
}
2024-06-10 20:43:34 +00:00
public static function ownedByCurrentTeam()
2024-02-01 14:38:12 +00:00
{
return Tag::whereTeamId(currentTeam()->id)->orderBy('name');
}
2024-06-10 20:43:34 +00:00
2024-02-01 14:38:12 +00:00
public function applications()
{
return $this->morphedByMany(Application::class, 'taggable');
}
2024-06-10 20:43:34 +00:00
2024-02-03 11:39:07 +00:00
public function services()
{
return $this->morphedByMany(Service::class, 'taggable');
2024-02-01 14:38:12 +00:00
}
}