2024-02-01 14:38:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2025-08-19 10:14:48 +00:00
|
|
|
use App\Traits\HasSafeStringAttribute;
|
2024-02-01 14:38:12 +00:00
|
|
|
|
|
|
|
|
class Tag extends BaseModel
|
|
|
|
|
{
|
2025-08-19 10:14:48 +00:00
|
|
|
use HasSafeStringAttribute;
|
2025-08-19 09:04:23 +00:00
|
|
|
|
2024-02-01 14:38:12 +00:00
|
|
|
protected $guarded = [];
|
|
|
|
|
|
2025-08-19 10:14:48 +00:00
|
|
|
protected function customizeName($value)
|
2024-02-01 14:38:12 +00:00
|
|
|
{
|
2025-08-19 10:14:48 +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
|
|
|
}
|
|
|
|
|
}
|