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
d6095b30
Unverified
Commit
d6095b30
authored
Nov 09, 2022
by
Guilherme Silva de Souza
Committed by
GitHub
Nov 09, 2022
Browse files
Merge pull request #670 from antonioDurval/master
Adicionando categoria(baseado nas naturezas) para um avaliador
parents
51e764ce
24cfb954
Changes
5
Show whitespace changes
Inline
Side-by-side
app/Avaliador.php
View file @
d6095b30
...
@@ -34,4 +34,7 @@ class Avaliador extends Model
...
@@ -34,4 +34,7 @@ class Avaliador extends Model
return
$this
->
hasMany
(
ParecerInterno
::
class
,
'avali_id'
,
'id'
);
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
View file @
d6095b30
...
@@ -14,6 +14,7 @@ use App\Endereco;
...
@@ -14,6 +14,7 @@ use App\Endereco;
use
App\Trabalho
;
use
App\Trabalho
;
use
App\Coautor
;
use
App\Coautor
;
use
App\Evento
;
use
App\Evento
;
use
App\Natureza
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
Illuminate\Validation\Rule
;
use
Illuminate\Validation\Rule
;
use
Illuminate\Support\Facades\Hash
;
use
Illuminate\Support\Facades\Hash
;
...
@@ -106,6 +107,8 @@ class UserController extends Controller
...
@@ -106,6 +107,8 @@ class UserController extends Controller
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
->
user_id
=
$user
->
id
;
$avaliador
->
user_id
=
$user
->
id
;
//$avaliador->area_id = $request->area;
//$avaliador->area_id = $request->area;
$avaliador
->
naturezas
()
->
sync
(
$request
->
natureza
);
$avaliador
->
update
();
$avaliador
->
update
();
}
}
...
@@ -206,11 +209,13 @@ class UserController extends Controller
...
@@ -206,11 +209,13 @@ class UserController extends Controller
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$avaliador
=
Avaliador
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$proponente
=
Proponente
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$proponente
=
Proponente
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$participante
=
Participante
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$participante
=
Participante
::
where
(
'user_id'
,
'='
,
$id
)
->
first
();
$naturezas
=
Natureza
::
orderBy
(
'nome'
)
->
get
();
return
view
(
'user.perfilUser'
)
->
with
([
'user'
=>
$user
,
return
view
(
'user.perfilUser'
)
->
with
([
'user'
=>
$user
,
'adminResp'
=>
$adminResp
,
'adminResp'
=>
$adminResp
,
'avaliador'
=>
$avaliador
,
'avaliador'
=>
$avaliador
,
'proponente'
=>
$proponente
,
'proponente'
=>
$proponente
,
'participante'
=>
$participante
]);
'participante'
=>
$participante
,
'naturezas'
=>
$naturezas
]);
}
}
}
}
app/Natureza.php
View file @
d6095b30
...
@@ -9,4 +9,8 @@ class Natureza extends Model
...
@@ -9,4 +9,8 @@ class Natureza extends Model
public
function
projetos
()
{
public
function
projetos
()
{
return
$this
->
hasMany
(
'App\Evento'
);
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 @
d6095b30
<?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
View file @
d6095b30
...
@@ -134,6 +134,17 @@
...
@@ -134,6 +134,17 @@
</
span
>
</
span
>
@
enderror
@
enderror
</
div
>
</
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
@
else
<
div
class
=
"col-md-6"
>
<
div
class
=
"col-md-6"
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
...
...
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