mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-23 09:40:39 +00:00
zip api update
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace Domain\Zip\Actions;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Domain\Folders\Models\Folder;
|
||||
|
||||
class GetItemsListFromUrlParamAction
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
$list = explode(',', request()->get('items'));
|
||||
|
||||
$itemList = collect($list)
|
||||
->map(function ($chunk) {
|
||||
$items = explode('|', $chunk);
|
||||
|
||||
return [
|
||||
'id' => $items[0],
|
||||
'type' => $items[1],
|
||||
];
|
||||
});
|
||||
|
||||
$folderIds = $itemList
|
||||
->where('type', 'folder')
|
||||
->pluck('id');
|
||||
|
||||
$fileIds = $itemList
|
||||
->where('type', 'file')
|
||||
->pluck('id');
|
||||
|
||||
$folders = Folder::whereIn('id', $folderIds)
|
||||
->get();
|
||||
|
||||
$files = File::whereIn('id', $fileIds)
|
||||
->get();
|
||||
|
||||
return [$folders, $files];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user