Skip to content

Commit

Permalink
Fixed bug when sorting attached files
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Sep 17, 2020
1 parent 4a83056 commit 31d3eb3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public function sort(Request $request): void
foreach ($request->all() as $position => $item) {
DB::table('model_has_files')
->where('file_id', $item['id'])
->where('model_id', $item['pivot']['model_id'])
->where('model_type', $item['pivot']['model_type'])
->update(['position' => $position + 1]);
}
cache()->flush();
Expand Down

0 comments on commit 31d3eb3

Please sign in to comment.