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
2593515b
Commit
2593515b
authored
Jul 02, 2021
by
Gabriel-31415
Browse files
ajuste em editar e visualizar trabalho de outra pessoa
parent
79aa5544
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/TrabalhoController.php
View file @
2593515b
...
@@ -315,8 +315,11 @@ class TrabalhoController extends Controller
...
@@ -315,8 +315,11 @@ class TrabalhoController extends Controller
public
function
show
(
$id
)
public
function
show
(
$id
)
{
{
//
$projeto
=
Trabalho
::
find
(
$id
);
$projeto
=
Auth
::
user
()
->
proponentes
->
trabalhos
()
->
where
(
'id'
,
$id
)
->
first
();
if
(
!
$projeto
){
return
back
()
->
withErrors
([
'Proposta não encontrada!'
]);
}
$edital
=
Evento
::
find
(
$projeto
->
evento_id
);
$edital
=
Evento
::
find
(
$projeto
->
evento_id
);
$grandeAreas
=
GrandeArea
::
all
();
$grandeAreas
=
GrandeArea
::
all
();
$areas
=
Area
::
all
();
$areas
=
Area
::
all
();
...
@@ -343,7 +346,10 @@ class TrabalhoController extends Controller
...
@@ -343,7 +346,10 @@ class TrabalhoController extends Controller
public
function
exportProjeto
(
$id
)
public
function
exportProjeto
(
$id
)
{
{
$projeto
=
Trabalho
::
find
(
$id
);
$projeto
=
Auth
::
user
()
->
proponentes
->
trabalhos
()
->
where
(
'id'
,
$id
)
->
first
();
if
(
!
$projeto
){
return
back
()
->
withErrors
([
'Proposta não encontrada!'
]);
}
$edital
=
Evento
::
find
(
$projeto
->
evento_id
);
$edital
=
Evento
::
find
(
$projeto
->
evento_id
);
$grandeAreas
=
GrandeArea
::
all
();
$grandeAreas
=
GrandeArea
::
all
();
$areas
=
Area
::
all
();
$areas
=
Area
::
all
();
...
@@ -365,7 +371,10 @@ class TrabalhoController extends Controller
...
@@ -365,7 +371,10 @@ class TrabalhoController extends Controller
public
function
edit
(
$id
)
public
function
edit
(
$id
)
{
{
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
$proponente
=
Proponente
::
where
(
'user_id'
,
Auth
::
user
()
->
id
)
->
first
();
$projeto
=
Trabalho
::
find
(
$id
);
$projeto
=
Auth
::
user
()
->
proponentes
->
trabalhos
()
->
where
(
'id'
,
$id
)
->
first
();
if
(
!
$projeto
){
return
back
()
->
withErrors
([
'Proposta não encontrada!'
]);
}
$edital
=
Evento
::
find
(
$projeto
->
evento_id
);
$edital
=
Evento
::
find
(
$projeto
->
evento_id
);
$grandeAreas
=
GrandeArea
::
all
();
$grandeAreas
=
GrandeArea
::
all
();
$areas
=
Area
::
all
();
$areas
=
Area
::
all
();
...
@@ -683,8 +692,7 @@ class TrabalhoController extends Controller
...
@@ -683,8 +692,7 @@ class TrabalhoController extends Controller
public
function
update
(
UpdateTrabalho
$request
,
$id
)
public
function
update
(
UpdateTrabalho
$request
,
$id
)
{
{
// dd($request->participante_id);
// dd( $request->all() );
try
{
try
{
if
(
!
$request
->
has
(
'rascunho'
)
)
{
if
(
!
$request
->
has
(
'rascunho'
)
)
{
$request
->
merge
([
$request
->
merge
([
...
@@ -699,10 +707,12 @@ class TrabalhoController extends Controller
...
@@ -699,10 +707,12 @@ class TrabalhoController extends Controller
$request
->
merge
([
$request
->
merge
([
'coordenador_id'
=>
$evento
->
coordenadorComissao
->
id
'coordenador_id'
=>
$evento
->
coordenadorComissao
->
id
]);
]);
$trabalho
=
Auth
::
user
()
->
proponentes
->
trabalhos
()
->
where
(
'id'
,
$id
)
->
first
();
DB
::
beginTransaction
();
DB
::
beginTransaction
();
if
(
!
$trabalho
){
$trabalho
=
Auth
::
user
()
->
proponentes
->
trabalhos
()
->
where
(
'id'
,
$id
)
->
first
();
return
back
()
->
withErrors
([
'Proposta não encontrada'
]);
}
$pasta
=
'trabalhos/'
.
$evento
->
id
.
'/'
.
$trabalho
->
id
;
$pasta
=
'trabalhos/'
.
$evento
->
id
.
'/'
.
$trabalho
->
id
;
$trabalho
=
$this
->
armazenarAnexosFinais
(
$request
,
$pasta
,
$trabalho
,
$evento
);
$trabalho
=
$this
->
armazenarAnexosFinais
(
$request
,
$pasta
,
$trabalho
,
$evento
);
$trabalho
->
save
();
$trabalho
->
save
();
...
...
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