*/ use HasFactory; use HasTranslations; /** * The attributes that are mass assignable. * * @var list */ #[\Override] protected $fillable = [ 'title', 'url', 'estimate_time', 'spent_time', 'is_closed', 'gitlab_id', 'gitlab_iid', 'milestone_iid', 'gitlab_project_id', 'g_created_at', 'g_updated_at', 'g_closed_at', 'g_due_date', ]; /** * The translatable columns. * * @var list */ public $translatable = [ 'title', ]; /** * The attributes that should be cast. * * @var array */ #[\Override] protected $casts = [ 'is_closed' => 'boolean', ]; /** * Perform any actions required after the model boots. */ #[\Override] protected static function booted(): void { static::creating(function (self $model): void { self::manageFields($model); }); static::updating(function (self $model): void { self::manageFields($model); }); } // * METHODS. /** * Manage model fields. */ private static function manageFields(self $model): void { TranslationHelper::assertTranslationFieldIsUnique($model, $model->title, 'title'); TranslationHelper::validateFallbackTranslations($model); } }