© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
Bruno Silva

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'),
          ]),
    ]),
]),
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()
Call to undefined method App\Models\Content::questions()


If a add a
 ->model(ContentQuiz) 
 ->model(ContentQuiz) 
in the
 Repeater 
 Repeater 
chain, it works on the create page, but stops working in the edit page
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

morphTo relationship
FilamentFFilament / ❓┊help
3y ago
Locale switcher doesn't work properly on form repeater with relationship
FilamentFFilament / ❓┊help
3y ago
Creating or Saving MorphTo relationship
FilamentFFilament / ❓┊help
2y ago
Repeater with hasMany relationship
FilamentFFilament / ❓┊help
3y ago