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
d0d91056
Unverified
Commit
d0d91056
authored
Nov 09, 2022
by
Nathalia Santos
Committed by
GitHub
Nov 09, 2022
Browse files
Merge branch 'master' into master
parents
09428058
d6095b30
Changes
5
Show whitespace changes
Inline
Side-by-side
app/Avaliador.php
View file @
d0d91056
...
...
@@ -34,4 +34,7 @@ class Avaliador extends Model
return
$this
->
hasMany
(
ParecerInterno
::
class
,
'avali_id'
,
'id'
);
}
public
function
naturezas
(){
return
$this
->
belongsToMany
(
'App\Natureza'
,
'naturezas_avaliadors'
,
'avaliador_id'
);
}
}
app/Http/Controllers/UserController.php
100755 → 100644
View file @
d0d91056
...
...
@@ -14,6 +14,7 @@ use App\Endereco;
use
App\Trabalho
;
use
App\Coautor
;
use
App\Evento
;
use
App\Natureza
;
use
Carbon\Carbon
;
use
Illuminate\Validation\Rule
;
use
Illuminate\Support\Facades\Hash
;
...
...
@@ -101,11 +102,15 @@ class UserController extends Controller
return
redirect
()
->
back
()
->
withErrors
([
'nova_senha'
=>
'Senhas diferentes'
]);
}
}
if
(
$user
->
avaliadors
!=
null
&&
$request
->
area
!=
null
&&
$user
->
tipo
==
"avaliador"
)
{
if
(
$user
->
avaliadors
!=
null
&&
$request
->
area
!=
null
&&
$user
->
tipo
==
"avaliador"
){
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
->
user_id
=
$user
->
id
;
//$avaliador->area_id = $request->area;
$avaliador
->
naturezas
()
->
sync
(
$request
->
natureza
);
$avaliador
->
update
();
}
switch
(
$request
->
tipo
)
{
...
...
@@ -208,15 +213,16 @@ class UserController extends Controller
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$proponente
=
Proponente
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$participante
=
Participante
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$naturezas
=
Natureza
::
orderBy
(
'nome'
)
->
get
();
$cursos
=
Curso
::
orderBy
(
'nome'
)
->
get
();
return
view
(
'user.perfilUser'
)
->
with
([
'user'
=>
$user
,
return
view
(
'user.perfilUser'
)
->
with
([
'user'
=>
$user
,
'adminResp'
=>
$adminResp
,
'avaliador'
=>
$avaliador
,
'proponente'
=>
$proponente
,
'participante'
=>
$participante
,
'cursos'
=>
$cursos
]);
'cursos'
=>
$cursos
,
'naturezas'
=>
$naturezas
]);
}
}
app/Natureza.php
View file @
d0d91056
...
...
@@ -9,4 +9,8 @@ class Natureza extends Model
public
function
projetos
()
{
return
$this
->
hasMany
(
'App\Evento'
);
}
public
function
avaliadors
(){
return
$this
->
belongsToMany
(
'App\Avaliador'
,
'naturezas_avaliadors'
,
'natureza_id'
);
}
}
database/migrations/2022_11_04_172506_create_naturezas_avaliadors_table.php
0 → 100644
View file @
d0d91056
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateNaturezasAvaliadorsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'naturezas_avaliadors'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
timestamps
();
$table
->
integer
(
'natureza_id'
);
$table
->
foreign
(
'natureza_id'
)
->
references
(
'id'
)
->
on
(
'naturezas'
);
$table
->
integer
(
'avaliador_id'
);
$table
->
foreign
(
'avaliador_id'
)
->
references
(
'id'
)
->
on
(
'avaliadors'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'naturezas_avaliadors'
);
}
}
resources/views/user/perfilUser.blade.php
100755 → 100644
View file @
d0d91056
...
...
@@ -150,7 +150,19 @@
</
span
>
@
enderror
</
div
>
<
div
class
=
"col-md-6"
>
<
label
for
=
"area"
class
=
"col-form-label"
>
{{
__
(
'Natureza:'
)
}}
</
label
>
<
br
>
@
foreach
(
$naturezas
as
$natureza
)
<
input
type
=
"checkbox"
name
=
"natureza[]"
id
=
"natureza
{
{$natureza->id}
}
"
value
=
"
{
{$natureza->id}
}
"
@
if
((
empty
(
old
(
'natureza'
))
&&
$avaliador
->
naturezas
->
contains
(
$natureza
->
id
))
||
(
!
empty
(
old
(
'natureza'
))
&&
in_array
(
$natureza
->
id
,
old
(
'natureza'
))))
checked
@
endif
>
<
label
class
=
"form-check-label"
for
=
"natureza
{
{$natureza->id}
}
"
>
{{
$natureza
->
nome
}}
</
label
>
@
endforeach
</
div
>
@
else
<
div
class
=
"col-md-6"
>
<
div
class
=
"form-group"
>
<
label
for
=
"cargo"
class
=
"col-form-label"
>
{{
__
(
'Cargo*'
)
}}
</
label
>
...
...
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