|
@@ -220,9 +220,15 @@ class ContainerController extends Controller
|
|
|
|
|
|
public function linkage(string $libraryId)
|
|
|
{
|
|
|
- $items = Container::select(['id', 'name'])->withCount(['folder' => function ($query) {
|
|
|
- $query->where('parent_id', 0);
|
|
|
- }])->allowed()->where("library_id", $libraryId)->get()->each(function ($items) {
|
|
|
+ $items = Container::select(['id', 'name'])
|
|
|
+ ->withCount(['folder' => function ($query) {
|
|
|
+ $query->where('parent_id', 0);
|
|
|
+ }])
|
|
|
+ ->withCount(['file' => function ($query) {
|
|
|
+ $query->where('folder_id', 0);
|
|
|
+ }])
|
|
|
+ ->allowed()->where("library_id", $libraryId)->get()->each(function ($items) {
|
|
|
+
|
|
|
// 设置固定的type值
|
|
|
$items->type = 'container';
|
|
|
$items->uniId=$items->type.'_'.$items->id;
|