Replace all uses of `forceFill`, `forceCreate`, and `forceFill` with their non-force equivalents across models, actions, controllers, and Livewire components. Add explicit `$fillable` arrays to all affected Eloquent models to enforce mass assignment protection. Add ModelFillableCreationTest and ModelFillableRegressionTest to verify that model creation respects fillable constraints and prevent regressions.
35 lines
654 B
PHP
35 lines
654 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\HasSafeStringAttribute;
|
|
|
|
class Tag extends BaseModel
|
|
{
|
|
use 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');
|
|
}
|
|
}
|