Commit 120fe191 authored by PedroLopesUPE's avatar PedroLopesUPE
Browse files

Adição da função de salvar PDF em sistema

parent ff346de2
......@@ -118,12 +118,15 @@ class UserPadController extends Controller
}
/**
* Generate PDF, with a given user_pad_id
* Return generated PDF, with a given user_pad_id;
*
* Additionally, if a filename is given, function will save PDF in storage;
*
* @param integer $user_pad_id
* @param string $fileName
* @return \Illuminate\Http\Response
*/
public function generatePDF($user_pad_id)
public function generatePDF($user_pad_id, $fileName="")
{
$niveis = Nivel::listNivel();
$funcoes = Funcao::listFuncaoEnsino() +
......@@ -400,6 +403,14 @@ class UserPadController extends Controller
$pdf_name = " Relatório PAD - " . $userPad->user->{'name'};
$pdf = PDF::loadView('pad.teacher.report_pdf', $data);
return $pdf->download($pdf_name . ".pdf");
if ($fileName == "")
{
return $pdf->download($pdf_name . ".pdf");
}
else
{
$pdf->save($fileName);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment