How to add morphToMany field value from the form ?

I have a file submission feature and each submission have notes which is morphic and I have to add first note during the creation of the submission
Solution:
Thanks @sfrigzs I used Repeater ``` Repeater::make('notes') ->deletable(false) ->addable(false)...
Jump to solution
5 Replies
sfrigzs
sfrigzs7mo ago
Put your fields inside a fieldset and set relationship
Asmit Nepali
Asmit NepaliOP7mo ago
@sfrigzs
Fieldset::make('Submission Notes')
->relationship('notes')
->schema([
RichEditor::make('description')
->label('Note'),
]),
Fieldset::make('Submission Notes')
->relationship('notes')
->schema([
RichEditor::make('description')
->label('Note'),
]),
TypeError
PHP 8.3.6
11.4.0
Filament\Forms\Components\Fieldset::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\HasOne|Illuminate\Database\Eloquent\Relations\MorphOne|null, Illuminate\Database\Eloquent\Relations\MorphMany returned
TypeError
PHP 8.3.6
11.4.0
Filament\Forms\Components\Fieldset::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\HasOne|Illuminate\Database\Eloquent\Relations\MorphOne|null, Illuminate\Database\Eloquent\Relations\MorphMany returned
Asmit Nepali
Asmit NepaliOP7mo ago
Sure
Solution
Asmit Nepali
Asmit Nepali7mo ago
Thanks @sfrigzs I used Repeater
Repeater::make('notes')
->deletable(false)
->addable(false)
->relationship('notes')
->schema([
RichEditor::make('description')
->required()
->columnSpanFull(),
]),
Repeater::make('notes')
->deletable(false)
->addable(false)
->relationship('notes')
->schema([
RichEditor::make('description')
->required()
->columnSpanFull(),
]),
Want results from more Discord servers?
Add your server