Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
submeta
Commits
2db103c8
Commit
2db103c8
authored
Oct 30, 2021
by
Guilherme Silva
Browse files
Criado funções para listagem e anexação dos relatórios
parent
32c9d6b5
Changes
1
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/ArquivoController.php
View file @
2db103c8
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use
App\Arquivo
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Http\Request
;
use
mysql_xdevapi
\
Exception
;
class
ArquivoController
extends
Controller
{
...
...
@@ -93,4 +94,26 @@ class ArquivoController extends Controller
}
return
abort
(
404
);
}
public
function
listar
(
$id
){
$arquivos
=
Arquivo
::
where
(
'trabalhoId'
,
$id
)
->
get
();
return
view
(
'planosTrabalho.listar'
)
->
with
([
'arquivos'
=>
$arquivos
]);
}
public
function
anexarRelatorio
(
Request
$request
){
try
{
$arquivo
=
Arquivo
::
where
(
'id'
,
$request
->
arqId
)
->
first
();
$pasta
=
'planoTrabalho/'
.
$arquivo
->
id
;
if
(
$request
->
relatorioParcial
!=
null
)
{
$arquivo
->
relatorioParcial
=
Storage
::
putFileAs
(
$pasta
,
$request
->
relatorioParcial
,
"RelatorioParcial.pdf"
);
}
if
(
$request
->
relatorioFinal
!=
null
)
{
$arquivo
->
relatorioFinal
=
Storage
::
putFileAs
(
$pasta
,
$request
->
relatorioFinal
,
"RelatorioFinal.pdf"
);
}
$arquivo
->
save
();
return
redirect
(
route
(
'planos.listar'
,
[
'id'
=>
$request
->
projId
]));
}
catch
(
Exception
$th
){
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment