@@ -63,8 +63,8 @@ private function uploadRelationshipFiles(Model $entry, mixed $value): Model
6363 $ value = $ value ->slice ($ modelCount , 1 )->toArray ();
6464
6565 foreach (app ('UploadersRepository ' )->getRepeatableUploadersFor ($ this ->getRepeatableContainerName ()) as $ uploader ) {
66- if (array_key_exists ($ modelCount , $ value ) && isset ( $ value [ $ modelCount ][ $ uploader ->getName () ])) {
67- $ entry ->{$ uploader ->getName ()} = $ uploader ->uploadFiles ($ entry , $ value [$ modelCount ][$ uploader ->getName ()]);
66+ if (array_key_exists ($ modelCount , $ value ) && array_key_exists ( $ uploader ->getAttributeName (), $ value [ $ modelCount ])) {
67+ $ entry ->{$ uploader ->getAttributeName ()} = $ uploader ->uploadFiles ($ entry , $ value [$ modelCount ][$ uploader ->getAttributeName ()]);
6868 }
6969 }
7070
@@ -74,10 +74,10 @@ private function uploadRelationshipFiles(Model $entry, mixed $value): Model
7474 protected function processRepeatableUploads (Model $ entry , Collection $ values ): Collection
7575 {
7676 foreach (app ('UploadersRepository ' )->getRepeatableUploadersFor ($ this ->getRepeatableContainerName ()) as $ uploader ) {
77- $ uploadedValues = $ uploader ->uploadRepeatableFiles ($ values ->pluck ($ uploader ->getName ())->toArray (), $ this ->getPreviousRepeatableValues ($ entry , $ uploader ));
77+ $ uploadedValues = $ uploader ->uploadRepeatableFiles ($ values ->pluck ($ uploader ->getAttributeName ())->toArray (), $ this ->getPreviousRepeatableValues ($ entry , $ uploader ));
7878
7979 $ values = $ values ->map (function ($ item , $ key ) use ($ uploadedValues , $ uploader ) {
80- $ item [$ uploader ->getName ()] = $ uploadedValues [$ key ] ?? null ;
80+ $ item [$ uploader ->getAttributeName ()] = $ uploadedValues [$ key ] ?? null ;
8181
8282 return $ item ;
8383 });
@@ -98,7 +98,7 @@ private function retrieveRepeatableFiles(Model $entry): Model
9898 $ values = is_string ($ values ) ? json_decode ($ values , true ) : $ values ;
9999 $ values = array_map (function ($ item ) use ($ repeatableUploaders ) {
100100 foreach ($ repeatableUploaders as $ upload ) {
101- $ item [$ upload ->getName ()] = $ this ->getValuesWithPathStripped ($ item , $ upload );
101+ $ item [$ upload ->getAttributeName ()] = $ this ->getValuesWithPathStripped ($ item , $ upload );
102102 }
103103
104104 return $ item ;
@@ -114,9 +114,9 @@ private function retrieveRepeatableRelationFiles(Model $entry)
114114 switch ($ this ->getRepeatableRelationType ()) {
115115 case 'BelongsToMany ' :
116116 $ pivotClass = app ('crud ' )->getModel ()->{$ this ->getUploaderSubfield ()['baseEntity ' ]}()->getPivotClass ();
117- $ pivotFieldName = 'pivot_ ' .$ this ->getName ();
118- $ connectedEntry = new $ pivotClass ([$ this ->getName () => $ entry ->$ pivotFieldName ]);
119- $ entry ->{$ pivotFieldName } = $ this ->retrieveFiles ($ connectedEntry )->{$ this ->getName ()};
117+ $ pivotFieldName = 'pivot_ ' .$ this ->getAttributeName ();
118+ $ connectedEntry = new $ pivotClass ([$ this ->getAttributeName () => $ entry ->$ pivotFieldName ]);
119+ $ entry ->{$ pivotFieldName } = $ this ->retrieveFiles ($ connectedEntry )->{$ this ->getAttributeName ()};
120120
121121 break ;
122122 default :
@@ -162,7 +162,7 @@ private function deleteRepeatableFiles(Model $entry): void
162162 return ;
163163 }
164164
165- $ files = $ connectedPivot ->getOriginal ()['pivot_ ' .$ this ->getName ()];
165+ $ files = $ connectedPivot ->getOriginal ()['pivot_ ' .$ this ->getAttributeName ()];
166166
167167 if (! $ files ) {
168168 return ;
0 commit comments