feat: tags and tag deploy webhooks
This commit is contained in:
@@ -211,6 +211,10 @@ class Application extends BaseModel
|
||||
: explode(',', $this->ports_exposes)
|
||||
);
|
||||
}
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
public function team()
|
||||
{
|
||||
return data_get($this, 'environment.project.team');
|
||||
|
||||
32
app/Models/Tag.php
Normal file
32
app/Models/Tag.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Tag extends BaseModel
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
public function name(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => strtolower($value),
|
||||
set: fn ($value) => strtolower($value)
|
||||
);
|
||||
}
|
||||
static public function ownedByCurrentTeam()
|
||||
{
|
||||
return Tag::whereTeamId(currentTeam()->id)->orderBy('name');
|
||||
}
|
||||
public function applications()
|
||||
{
|
||||
return $this->morphedByMany(Application::class, 'taggable');
|
||||
}
|
||||
|
||||
public function resources() {
|
||||
return $this->applications();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user