package models import "time" // Menu is a named menu stored on golem15_menu_menus, the PHP // Golem15\Menu\Models\Menu. Sites address a menu by its unique code. type Menu struct { ID uint `gorm:"column:id;primaryKey"` Name string `gorm:"column:name"` Code string `gorm:"column:code"` IsActive bool `gorm:"column:is_active"` CSSClass *string `gorm:"column:css_class"` Entries []MenuEntry `gorm:"foreignKey:MenuID" json:"-"` CreatedAt *time.Time `gorm:"column:created_at"` UpdatedAt *time.Time `gorm:"column:updated_at"` } func (Menu) TableName() string { return "golem15_menu_menus" } // MorphName is the PHP class string of the model. func (Menu) MorphName() string { return `Golem15\Menu\Models\Menu` } // Fillable is the list an admin save may set. func (Menu) Fillable() []string { return []string{"name", "code", "is_active", "css_class"} } // Rules require a name and a code that no other menu uses. func (Menu) Rules() map[string]string { return map[string]string{ "name": "required", "code": "required|unique:golem15_menu_menus", } } func init() { Register(Menu{}) }