Replace $guarded usage with explicit $fillable arrays across all models. Sync fillable definitions with current database schema and add tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
635 B
PHP
34 lines
635 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasSafeStringAttribute;
|
|
|
|
class Tag extends BaseModel
|
|
{
|
|
use HasSafeStringAttribute;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
];
|
|
|
|
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');
|
|
}
|
|
}
|