56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Imunizacao;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Imunizacao\BaixaService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
|
|
class BaixaController extends Controller
|
|
{
|
|
protected $modulo = 'imunizacao';
|
|
protected $funcionalidade = 'baixa';
|
|
|
|
public function index()
|
|
{
|
|
return response()->json(BaixaService::index(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(BaixaService::create(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(BaixaService::store($request), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function datatable()
|
|
{
|
|
return datatables()
|
|
->of(BaixaService::datatable())
|
|
->filterColumn('cadastro_infraestrutura.nome', function ($query, $keyword) {
|
|
|
|
$query->whereRaw("COALESCE(cadastro_infraestrutura.nome, cadastro_unidade.nome_fantasia) like ?", ["%{$keyword}%"]);
|
|
})
|
|
->skipTotalRecords()
|
|
->make(true);
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
return response()->json(BaixaService::list(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function historico()
|
|
{
|
|
return response()->json(BaixaService::historico(), Response::HTTP_OK);
|
|
}
|
|
}
|