BookStack\Services\AttachmentService::updateFileOrderWithinPage PHP Method

updateFileOrderWithinPage() public method

Updates the file ordering for a listing of attached files.
public updateFileOrderWithinPage ( array $attachmentList, $pageId )
$attachmentList array
$pageId
    public function updateFileOrderWithinPage($attachmentList, $pageId)
    {
        foreach ($attachmentList as $index => $attachment) {
            Attachment::where('uploaded_to', '=', $pageId)->where('id', '=', $attachment['id'])->update(['order' => $index]);
        }
    }