|
@@ -18,10 +18,8 @@ class LibraryController extends Controller
|
|
|
*/
|
|
|
public function index(Request $request)
|
|
|
{
|
|
|
- $pageSize = $request->get('pageSize', 10);
|
|
|
- $libraries = Library::filter(['id', 'name','type','asset_id','project_id'])->allowed()->paginate($pageSize);
|
|
|
+ $libraries = Library::query()->filter($request->all())->allowed()->get(['id', 'name','type','asset_id','project_id']);
|
|
|
|
|
|
- $total = $libraries->total();
|
|
|
$containerCount = Container::query()->allowed()
|
|
|
->whereIn("library_id", $libraries->pluck("id")->toArray())
|
|
|
->selectRaw("count(*) as cut, library_id")
|
|
@@ -41,8 +39,7 @@ class LibraryController extends Controller
|
|
|
});
|
|
|
|
|
|
return $this->success([
|
|
|
- 'data' => $libraries,
|
|
|
- 'total' => $total
|
|
|
+ 'data' => $libraries
|
|
|
]);
|
|
|
}
|
|
|
|
|
@@ -122,9 +119,9 @@ class LibraryController extends Controller
|
|
|
->where("type", $type)->when($where, fn($query) => $query->where($where))
|
|
|
->get(['id', 'name', 'created_at', 'updated_at'])
|
|
|
->each(function ($libraries) {
|
|
|
-
|
|
|
- $libraries->type = 'library';
|
|
|
- $libraries->uniId=$libraries->type.'_'.$libraries->id;
|
|
|
+
|
|
|
+ $libraries->type = 'library';
|
|
|
+ $libraries->uniId=$libraries->type.'_'.$libraries->id;
|
|
|
});
|
|
|
|
|
|
return $this->success([
|