@@ -235,10 +235,9 @@ public function filters(RestifyRequest $request)
235235
236236 /**
237237 * @param RestifyRequest $request
238- * @param int|null $bulkRow
239238 * @return FieldCollection
240239 */
241- public function collectFields (RestifyRequest $ request, int $ bulkRow = null )
240+ public function collectFields (RestifyRequest $ request )
242241 {
243242 $ method = 'fields ' ;
244243
@@ -266,7 +265,7 @@ public function collectFields(RestifyRequest $request, int $bulkRow = null)
266265 $ method = 'fieldsForUpdateBulk ' ;
267266 }
268267
269- $ fields = FieldCollection::make (array_values ($ this ->filter ($ this ->{$ method }($ request, $ bulkRow ))));
268+ $ fields = FieldCollection::make (array_values ($ this ->filter ($ this ->{$ method }($ request ))));
270269
271270 if ($ this instanceof Mergeable) {
272271 $ fillable = collect ($ this ->resource ->getFillable ())
@@ -300,9 +299,9 @@ private function updateFields(RestifyRequest $request)
300299 ->authorizedUpdate ($ request );
301300 }
302301
303- private function updateBulkFields (RestifyRequest $ request, int $ bulkRow )
302+ private function updateBulkFields (RestifyRequest $ request )
304303 {
305- return $ this ->collectFields ($ request, $ bulkRow )
304+ return $ this ->collectFields ($ request )
306305 ->forUpdateBulk ($ request , $ this )
307306 ->authorizedUpdateBulk ($ request );
308307 }
@@ -314,9 +313,9 @@ private function storeFields(RestifyRequest $request)
314313 ->authorizedStore ($ request );
315314 }
316315
317- private function storeBulkFields (RestifyRequest $ request, int $ bulkRow )
316+ private function storeBulkFields (RestifyRequest $ request )
318317 {
319- return $ this ->collectFields ($ request, $ bulkRow )
318+ return $ this ->collectFields ($ request )
320319 ->forStoreBulk ($ request , $ this )
321320 ->authorizedStore ($ request );
322321 }
@@ -621,17 +620,13 @@ public function storeBulk(RepositoryStoreBulkRequest $request)
621620 ->map (function (array $ input , $ row ) use ($ request ) {
622621 $ this ->resource = static ::newModel ();
623622
624- $ request ->merge ([
625- 'bulk_row ' => $ row ,
626- ]);
627-
628623 static ::fillBulkFields (
629- $ request , $ this ->resource , $ this ->storeBulkFields ($ request, $ row ), $ row
624+ $ request , $ this ->resource , $ this ->storeBulkFields ($ request ), $ row
630625 );
631626
632627 $ this ->resource ->save ();
633628
634- $ this ->storeBulkFields ($ request, $ row )->each (fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource ));
629+ $ this ->storeBulkFields ($ request )->each (fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource ));
635630
636631 return $ this ->resource ;
637632 });
@@ -662,7 +657,7 @@ public function update(RestifyRequest $request, $repositoryId)
662657
663658 public function updateBulk (RestifyRequest $ request , $ repositoryId , int $ row )
664659 {
665- $ fields = $ this ->updateBulkFields ($ request, $ row );
660+ $ fields = $ this ->updateBulkFields ($ request );
666661
667662 static ::fillBulkFields ($ request , $ this ->resource , $ fields , $ row );
668663
@@ -739,11 +734,11 @@ public function allowToStore(RestifyRequest $request, $payload = null): self
739734 return $ this ;
740735 }
741736
742- public function allowToBulkStore (RestifyRequest $ request , $ payload = null ): self
737+ public function allowToBulkStore (RestifyRequest $ request , $ payload = null , $ row = null ): self
743738 {
744739 static ::authorizeToStoreBulk ($ request );
745740
746- $ validator = static ::validatorForStoringBulk ($ request , $ payload );
741+ $ validator = static ::validatorForStoringBulk ($ request , $ payload, $ row );
747742
748743 $ validator ->validate ();
749744
0 commit comments