49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?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',
|
|
]);
|
|
}
|
|
|
|
} |