|
@@ -14,11 +14,13 @@ use App\Models\Enums\FileObjectType;
|
|
|
use App\Models\Enums\ObjectAction;
|
|
|
use App\Models\File;
|
|
|
use App\Models\Folder;
|
|
|
+use App\Models\Library;
|
|
|
use App\Repositories\ActionRepository;
|
|
|
use App\Repositories\CustomFieldRepository;
|
|
|
use App\Services\File\FileAssociationService;
|
|
|
use App\Services\File\ImageUrlService;
|
|
|
use App\Services\History\ModelChangeDetector;
|
|
|
+use Carbon\Carbon;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
@@ -249,4 +251,25 @@ class ContainerController extends Controller
|
|
|
return $this->noContent();
|
|
|
|
|
|
}
|
|
|
+ public function containerReport(){
|
|
|
+
|
|
|
+ $companyId=Auth::user()->company_id;
|
|
|
+ $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');
|
|
|
+
|
|
|
+ $MyLibrarys=Library::query()->allowed()->orderBy('updated_at', 'desc')->get(['id', 'name', 'created_at', 'updated_at']);
|
|
|
+ $MyContainers = Container::query()->allowed()->orderBy('updated_at', 'desc')->get( ['id', 'name', 'created_at', 'updated_at']);
|
|
|
+
|
|
|
+ return $this->success([
|
|
|
+ 'data' =>[
|
|
|
+ 'libraryCount'=>$libraryCount,
|
|
|
+ 'containerCount'=>$containerCount,
|
|
|
+ 'MyLibrarysCount'=>$MyLibrarys->count(),
|
|
|
+ 'MyContainersCount'=>$MyContainers->count(),
|
|
|
+ 'MyContainers'=>$MyContainers,
|
|
|
+ 'MyLibrarys'=>$MyLibrarys
|
|
|
+ ]
|
|
|
+ ]);
|
|
|
+ }
|
|
|
}
|