77 lines
1.8 KiB
PHP
77 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Cadastro;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Cadastro\ObitoService;
|
|
use Illuminate\Http\Response;
|
|
|
|
class ObitoController extends Controller
|
|
{
|
|
protected $modulo = 'cadastro';
|
|
protected $funcionalidade = 'obito';
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ObitoService::create(), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ObitoService::store(), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ObitoService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(ObitoService::update($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
ObitoService::destroy($id);
|
|
|
|
return response()->noContent();
|
|
}
|
|
|
|
public function datatable()
|
|
{
|
|
return datatables()
|
|
->of(ObitoService::datatable())
|
|
->filterColumn('cadastro_obito.obito_em', function ($query, $keyword) {
|
|
$query->whereRaw("DATE_FORMAT(cadastro_obito.obito_em, '%d/%m/%Y') like ?", ["%{$keyword}%"]);
|
|
})
|
|
->skipTotalRecords()
|
|
->toJson();
|
|
}
|
|
|
|
public function autocompleteCidadao()
|
|
{
|
|
return datatables()->of(ObitoService::autocompleteCidadao())->toJson();
|
|
}
|
|
|
|
public function autocompleteCid()
|
|
{
|
|
return datatables()->of(ObitoService::autocompleteCid())->toJson();
|
|
}
|
|
|
|
public function autocompleteUsuario()
|
|
{
|
|
return datatables()->of(ObitoService::autocompleteUsuario())->toJson();
|
|
}
|
|
}
|