This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\WebService\Laboratorio\Cliente;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\WebService\Laboratorio\Cliente\ExameService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ExameController extends Controller
|
||||
{
|
||||
protected $modulo = 'web-service';
|
||||
protected $funcionalidade = 'laboratorio-cliente-exame';
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request, $laboratorioId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::store($request, $laboratorioId), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExameService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(ExameService::datatable())
|
||||
->filterColumn('laboratorio_descricao', function ($query, $keyword) {
|
||||
$query->whereRaw("CONCAT(
|
||||
conectasus_unidade.nome_fantasia,
|
||||
IF(conectasus_infraestrutura.nome IS NOT NULL,
|
||||
CONCAT(' - ', conectasus_infraestrutura.nome),
|
||||
''
|
||||
)
|
||||
) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\WebService\Laboratorio\Cliente;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\WebService\Laboratorio\Cliente\LaboratorioService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LaboratorioController extends Controller
|
||||
{
|
||||
protected $modulo = 'web-service';
|
||||
protected $funcionalidade = 'laboratorio-cliente-laboratorio';
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(LaboratorioService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(LaboratorioService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(LaboratorioService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
LaboratorioService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(LaboratorioService::datatable())
|
||||
->filterColumn('conectasus_infraestrutura_nome', function ($query, $keyword) {
|
||||
$query->whereRaw(
|
||||
"COALESCE(conectasus_infraestrutura.nome, conectasus_unidade.nome_fantasia) LIKE ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user