37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
// Code generated by summer make. DO NOT EDIT.
|
|
|
|
package models
|
|
|
|
import "time"
|
|
|
|
// Answer is one choice of a single or multiple question.
|
|
type Answer struct {
|
|
ID uint `gorm:"column:id;primaryKey"`
|
|
QuestionID uint `gorm:"column:question_id"`
|
|
Text string `gorm:"column:text"`
|
|
IsCorrect bool `gorm:"column:is_correct"`
|
|
Explanation *string `gorm:"column:explanation"`
|
|
SortOrder int `gorm:"column:sort_order"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at"`
|
|
Question *Question `gorm:"foreignKey:QuestionID"`
|
|
}
|
|
|
|
// TableName is the plugin-prefixed table.
|
|
func (Answer) TableName() string { return "golem15_quizzes_answers" }
|
|
|
|
// Fillable lists the columns mass assignment may set.
|
|
func (Answer) Fillable() []string {
|
|
return []string{"question_id", "text", "is_correct", "explanation", "sort_order"}
|
|
}
|
|
|
|
// Rules are checked by the admin API on every save.
|
|
func (Answer) Rules() map[string]string {
|
|
return map[string]string{
|
|
"question_id": "required|integer|min:1",
|
|
"text": "required",
|
|
"is_correct": "boolean",
|
|
"sort_order": "nullable|integer",
|
|
}
|
|
}
|