This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Externo\Laboratorio\Cliente;
|
||||
|
||||
use App\Http\Controllers\Externo\Laboratorio\Controller;
|
||||
use App\Services\WebService\Laboratorio\Cliente\ExameService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ExameController extends Controller
|
||||
{
|
||||
protected $controller = __CLASS__;
|
||||
|
||||
public function index($laboratorioId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::index($laboratorioId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function show($laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::show($laboratorioId, $id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request, $laboratorioId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::store($request, $laboratorioId), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function update(Request $request, $laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::update($request, $laboratorioId, $id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
ExameService::destroy($laboratorioId, $id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Externo\Laboratorio\Cliente;
|
||||
|
||||
use App\Exceptions\WebService\Laboratorio\Cliente\Pedido\CannotChangeStatusException;
|
||||
use App\Http\Controllers\Externo\Laboratorio\Controller;
|
||||
use App\Services\WebService\Laboratorio\Cliente\PedidoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class PedidoController extends Controller
|
||||
{
|
||||
protected $controller = __CLASS__;
|
||||
|
||||
public function index(Request $request, $laboratorioId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(PedidoService::index($request, $laboratorioId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function show($laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(PedidoService::show($laboratorioId, $id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function process($laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
PedidoService::process($laboratorioId, $id);
|
||||
|
||||
return response()->noContent();
|
||||
} catch (CannotChangeStatusException $e) {
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function cancel(Request $request, $laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
PedidoService::cancel($request, $laboratorioId, $id);
|
||||
|
||||
return response()->noContent();
|
||||
} catch (CannotChangeStatusException $e) {
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeResult(Request $request, $laboratorioId, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
PedidoService::storeResult($request, $laboratorioId, $id);
|
||||
|
||||
return response()->noContent();
|
||||
} catch (CannotChangeStatusException $e) {
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user