feat: Implement new admin API endpoints for product, customer, vCenter, and authentication, and add vCenter resource management UI.

This commit is contained in:
pbao9
2026-03-05 14:30:31 +07:00
parent 68540009c0
commit cca4e0b86f
47 changed files with 3538 additions and 1086 deletions
@@ -0,0 +1,34 @@
<?php
namespace App\Repositories\Admin\Product;
use App\Models\Product;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
class AdminProductRepository implements AdminProductRepositoryInterface
{
public function paginate(array $filters, int $perPage): LengthAwarePaginator
{
$query = Product::with(['category', 'pricings' => fn($q) => $q->where('is_active', true)])
->orderBy('id', 'desc');
if ($filter = $filters['filter'] ?? null) {
$query->where('name', 'like', "%{$filter}%");
}
if ($type = $filters['type'] ?? null) {
$query->where('product_type', $type);
}
if (isset($filters['is_active']) && $filters['is_active'] !== '') {
$query->where('is_active', filter_var($filters['is_active'], FILTER_VALIDATE_BOOLEAN));
}
return $query->paginate($perPage);
}
public function findWithPricings(int $id): ?Product
{
return Product::with(['category', 'pricings'])->find($id);
}
}
@@ -0,0 +1,12 @@
<?php
namespace App\Repositories\Admin\Product;
use App\Models\Product;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
interface AdminProductRepositoryInterface
{
public function paginate(array $filters, int $perPage): LengthAwarePaginator;
public function findWithPricings(int $id): ?Product;
}