This commit is contained in:
66
api/app/Http/Controllers/Bpa/ExportacaoController.php
Normal file
66
api/app/Http/Controllers/Bpa/ExportacaoController.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bpa;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Bpa\ExportacaoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ExportacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'bpa';
|
||||
protected $funcionalidade = 'exportacao';
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::update($request, $id), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(ExportacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(ExportacaoService::datatable())
|
||||
->skipTotalRecords()
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function download($id)
|
||||
{
|
||||
$response = ExportacaoService::download($id);
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'text/plain;charset=UTF-8',
|
||||
];
|
||||
|
||||
return response()->download($response['arquivo'], $response['nome'], $headers);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user