package models import "time" // Category is a journal category stored on golem15_journal_categories. type Category struct { ID uint `gorm:"column:id;primaryKey"` Name string `gorm:"column:name"` Slug string `gorm:"column:slug"` Code *string `gorm:"column:code"` Description *string `gorm:"column:description"` Content *string `gorm:"column:content"` // HTML body (D-21): stored and served as is, not translatable ParentID *uint `gorm:"column:parent_id"` NestLeft *int `gorm:"column:nest_left"` NestRight *int `gorm:"column:nest_right"` NestDepth *int `gorm:"column:nest_depth"` CreatedAt *time.Time `gorm:"column:created_at"` UpdatedAt *time.Time `gorm:"column:updated_at"` } func (Category) TableName() string { return "golem15_journal_categories" } // MorphName is the PHP class string stored on translate attributes. func (Category) MorphName() string { return `Golem15\Journal\Models\Category` } func (Category) Translatable() []string { return []string{"name", "description", "slug"} } func (Category) TranslatableIndexes() []string { return []string{"slug"} } // Fillable is JOURNAL-002: nest_* stay out of mass assignment. func (Category) Fillable() []string { return []string{"name", "slug", "code", "description", "content", "parent_id"} } func (Category) Rules() map[string]string { return map[string]string{ "name": "required", "slug": "required", } } func init() { Register(Category{}) }