69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\TransportePaciente\Motivo;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Services\TransportePaciente\Motivo\MotivoService;
|
|
use Illuminate\Http\Response;
|
|
|
|
class MotivoController extends Controller
|
|
{
|
|
protected $modulo = 'transporte-paciente';
|
|
protected $funcionalidade = 'motivo-viagem-procedimento';
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoService::create(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoService::store(), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function datatable()
|
|
{
|
|
return MotivoService::datatable()->skipTotalRecords()->toJson();
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoService::update($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function bloquear($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoService::bloquear($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoService::destroy($id), Response::HTTP_NO_CONTENT);
|
|
}
|
|
|
|
public function autocomplete()
|
|
{
|
|
return datatables()
|
|
->of(MotivoService::autocomplete())
|
|
->make(true);
|
|
}
|
|
}
|