|
@@ -262,12 +262,12 @@ class ContainerController extends Controller
|
|
|
$librarys=Library::query()->where('company_id',$companyId)->withCount('container') ->get(['id', 'name', 'created_at', 'updated_at', 'container_count as container_count']);
|
|
|
$libraryCount=$librarys->count();
|
|
|
$containerCount = $librarys->sum('container_count');
|
|
|
- $libraryType = $request->type;
|
|
|
|
|
|
$MyLibrarys=Library::query()->allowed()->filter($request->all())->orderBy('updated_at', 'desc')->get(['id', 'name', 'type','created_at', 'updated_at']);
|
|
|
- $MyContainers = Container::query()->allowed()->when($libraryType,function ($query) use ($libraryType){
|
|
|
- $query->whereHas('library', function ($query) use ($libraryType) {
|
|
|
- $query->where('type', $libraryType);
|
|
|
+ $MyContainers = Container::query()->allowed()->when($request,function ($query) use ($request){
|
|
|
+ $query->whereHas('library', function ($query) use ($request) {
|
|
|
+ $query->where('type', $request->type)
|
|
|
+ ->where('asset_id',$request->asset);
|
|
|
});
|
|
|
})->orderBy('updated_at', 'desc')->get( ['id', 'name','library_id', 'created_at', 'updated_at']);
|
|
|
|