auth(__FUNCTION__); return response()->json(ExportacaoService::create(), Response::HTTP_OK); } public function store() { $this->auth(__FUNCTION__); return response()->json(ExportacaoService::store(), Response::HTTP_CREATED); } public function update($id) { $this->auth(__FUNCTION__); return response()->json(ExportacaoService::update($id), Response::HTTP_CREATED); } public function destroy($id) { $this->auth(__FUNCTION__); return response()->json(ExportacaoService::destroy($id), Response::HTTP_NO_CONTENT); } 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); } }