This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ExameLaboratorial;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\ExameLaboratorial\FormulaExameService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FormulaExameController extends Controller
|
||||
{
|
||||
protected $modulo = 'exame-laboratorial';
|
||||
protected $funcionalidade = 'formula-exame';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(FormulaExameService::datatable())
|
||||
->filterColumn('fatores', function ($query, $keyword) {
|
||||
$query->whereIn('exame_laboratorial_formula_exame.id', function ($subquery) use ($keyword) {
|
||||
$subquery->select('formula_exame_id')
|
||||
->from('exame_laboratorial_formula_exame_fator')
|
||||
->where('fator', 'LIKE', "%{$keyword}%");
|
||||
});
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormulaExameService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormulaExameService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormulaExameService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormulaExameService::update($request, $id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormulaExameService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user