This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\TransportePaciente\Jornada;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\TransportePaciente\Jornada\JornadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class JornadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'transporte-paciente';
|
||||
protected $funcionalidade = 'jornada';
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(JornadaService::datatable())
|
||||
->filterColumn('veiculo.numero_placa', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("veiculo.numero_placa like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(veiculo.numero_placa,1,3),
|
||||
'-',
|
||||
SUBSTR(veiculo.numero_placa,4,4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function destroySelected()
|
||||
{
|
||||
return response()->json(JornadaService::destroySelected(), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user