Repeater with MorphTo relationship don't work on create page

I have a polymorphic model "Content", and the possible entities "ContentVideo" and "ContentQuiz" for example.

in the "ContentResource" I have this form with a repeater, relating to the models "QuizQuestion" and "QuizOption".

Group::make()
  ->relationship('entity')
  ->schema([
    Repeater::make('questions')
      ->relationship()
      ->schema([
        Textarea::make('question'),
        Repeater::make('options')
          ->relationship()
          ->schema([
            TextInput::make('option'),
          ]),
    ]),
]),


so, "Content" morphsTo "ContentQuiz", "ContentQuiz" hasmany "questions", and "ContentQuestion" has many "options"

This repeater works on the edit page, but not on the create page, I get the error:
Call to undefined method App\Models\Content::questions()


If a add a ->model(ContentQuiz) in the Repeater chain, it works on the create page, but stops working in the edit page
Was this page helpful?