'boolean', 'sort' => 'integer', ]; /** * The "booted" method of the model. */ protected static function booted(): void { static::creating(function (ExamQuestionOption $option) { // Handle sort if (is_null($option->sort)) { $option->sort = static::getNextSortValue(); } }); } public function exam_question(): BelongsTo { return $this->belongsTo(ExamQuestion::class); } }