]> BookStack Code Mirror - bookstack/blobdiff - app/Uploads/AttachmentService.php
Update Localization.php in Middleware with "no" tag for estimate.
[bookstack] / app / Uploads / AttachmentService.php
index ae4fb6e967160787e1c46dde0e442228386f9af9..02220771aaee631e1d7bd0643d865d9196932b3e 100644 (file)
@@ -109,14 +109,14 @@ class AttachmentService extends UploadService
     }
 
     /**
-     * Updates the file ordering for a listing of attached files.
-     * @param array $attachmentList
-     * @param $pageId
+     * Updates the ordering for a listing of attached files.
      */
-    public function updateFileOrderWithinPage($attachmentList, $pageId)
+    public function updateFileOrderWithinPage(array $attachmentOrder, string $pageId)
     {
-        foreach ($attachmentList as $index => $attachment) {
-            Attachment::where('uploaded_to', '=', $pageId)->where('id', '=', $attachment['id'])->update(['order' => $index]);
+        foreach ($attachmentOrder as $index => $attachmentId) {
+            Attachment::query()->where('uploaded_to', '=', $pageId)
+                ->where('id', '=', $attachmentId)
+                ->update(['order' => $index]);
         }
     }