input('items') as $item) { if ($item['type'] === 'folder') { ($this->verifyAccessToItem)([ $request->input('to_id'), $item['id'], ], $shared); } if ($item['type'] !== 'folder') { $file = File::where('id', $item['id']) ->where('user_id', $shared->user_id) ->firstOrFail(); ($this->verifyAccessToItem)([ $request->input('to_id'), $file->parent_id, ], $shared); } } ($this->moveFileOrFolder)($request, $shared); return response('Done.', 204); } }