feat: Implement client-facing service management API with UUID for services and bulk actions for product services.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Client\Service;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\Api\Client\Service\ServiceClientDetailResource;
|
||||
use \App\Http\Resources\Api\Client\Service\ServiceClientResource;
|
||||
use App\Repositories\Api\ServiceClient\ServiceClientRepository;
|
||||
use App\Services\Api\ServiceClient\ServiceClientService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ServiceController extends Controller
|
||||
{
|
||||
protected $serviceClientService;
|
||||
protected $serviceClientRepository;
|
||||
|
||||
public function __construct(
|
||||
ServiceClientService $serviceClientService,
|
||||
ServiceClientRepository $serviceClientRepository
|
||||
) {
|
||||
$this->serviceClientService = $serviceClientService;
|
||||
$this->serviceClientRepository = $serviceClientRepository;
|
||||
}
|
||||
|
||||
public function getService(Request $request)
|
||||
{
|
||||
$limit = $request->get('limit', 10);
|
||||
$services = $this->serviceClientService->getActiveServices($limit);
|
||||
|
||||
return ServiceClientResource::collection($services)->additional([
|
||||
'error' => false,
|
||||
'message' => 'Lấy dữ liệu thành công',
|
||||
'page_type' => 'service',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function getDetail(Request $request, string $uuid)
|
||||
{
|
||||
$service = $this->serviceClientService->getDetailService($uuid);
|
||||
|
||||
return (new ServiceClientDetailResource($service))->additional([
|
||||
'error' => false,
|
||||
'message' => 'Lấy dữ liệu thành công',
|
||||
'page_type' => 'service',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user