61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Almoxarifado;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Almoxarifado\MotivoBaixaService;
|
|
use DB;
|
|
use Illuminate\Http\Response;
|
|
|
|
class MotivoBaixaController extends Controller
|
|
{
|
|
protected $modulo = 'almoxarifado';
|
|
protected $funcionalidade = 'motivo-baixa';
|
|
|
|
public function datatable()
|
|
{
|
|
return datatables()
|
|
->of(MotivoBaixaService::datatable())
|
|
->filterColumn('almoxarifado_motivo_baixa.justificar', function ($query, $keyword) {
|
|
$query->whereRaw('DECODE_ORACLE(almoxarifado_motivo_baixa.justificar, 1, "Sim", "Não") LIKE ?', ["%{$keyword}%"]);
|
|
})
|
|
->skipTotalRecords()
|
|
->toJson();
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoBaixaService::create(), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoBaixaService::store(), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoBaixaService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoBaixaService::update($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(MotivoBaixaService::destroy($id), Response::HTTP_NO_CONTENT);
|
|
}
|
|
}
|