This commit is contained in:
pbao9
2026-02-11 11:18:35 +07:00
parent d59b2a0840
commit 6b6385f441
27 changed files with 386 additions and 30 deletions
@@ -0,0 +1,35 @@
<?php
namespace App\Repositories\Api\Service;
use App\Models\Product;
use App\Repositories\Api\BaseApiRepository;
class ServiceRepository extends BaseApiRepository implements ServiceRepositoryInterface
{
public function getModel()
{
return Product::class;
}
/**
* Lấy danh sách sản phẩm đang hoạt động
*/
public function getActiveServices()
{
return $this->model
->with(['osVersions.osGroup', 'category'])
->where('is_active', 1)
->orderBy('sort_order', 'asc')
->get();
}
public function findActiveBySlug(string $slug)
{
return $this->model
->with(['osVersions.osGroup', 'category', 'pricings' => fn ($q) => $q->where('is_active', 1)])
->where('slug', $slug)
->where('is_active', 1)
->first();
}
}