62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Administracao;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Administracao\GestorService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
|
|
class GestorController extends Controller
|
|
{
|
|
protected $modulo = 'administracao';
|
|
protected $funcionalidade = 'gestor';
|
|
|
|
public function index()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(GestorService::index(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(GestorService::create(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(GestorService::store($request), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(GestorService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update(Request $request, $id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(GestorService::update($request, $id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(GestorService::destroy($id), Response::HTTP_NO_CONTENT);
|
|
}
|
|
|
|
public function datatable()
|
|
{
|
|
return datatables()->of(GestorService::datatable())->skipTotalRecords()->make(true);
|
|
}
|
|
}
|