This commit is contained in:
76
api/app/Http/Controllers/Cadastro/ObitoController.php
Normal file
76
api/app/Http/Controllers/Cadastro/ObitoController.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user