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
e8b5dfeb
"resources/views/vscode:/vscode.git/clone" did not exist on "289d4dad8402ce728fa42ba690bc7ec923c9dfdd"
Commit
e8b5dfeb
authored
May 13, 2023
by
Edgarvital
Browse files
Correção de validação de edição do estudante
parent
23132513
Changes
2
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
e8b5dfeb
...
...
@@ -5,6 +5,7 @@
/vendor
.env
.env.backup
.idea
.phpunit.result.cache
Homestead.json
Homestead.yaml
...
...
app/Http/Controllers/UserController.php
View file @
e8b5dfeb
...
...
@@ -75,7 +75,6 @@ class UserController extends Controller
$id
=
Auth
()
->
user
()
->
id
;
$user
=
User
::
find
(
$id
);
if
(
$request
->
tipo
!=
"proponente"
)
{
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'instituicao'
=>
[
'required_if:instituicaoSelect,Outra'
,
'max:255'
],
...
...
@@ -83,21 +82,6 @@ class UserController extends Controller
'celular'
=>
[
'required'
,
'string'
],
'cpf'
=>
[
'required'
,
'cpf'
],
]);
}
else
if
(
$user
->
tipo
==
'participante'
)
{
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'email'
=>
[
'required'
,
'string'
,
'email'
,
'max:255'
,
'unique:users'
],
'password'
=>
[
'required'
,
'string'
,
'min:8'
,
'confirmed'
],
'cpf'
=>
[
'required'
,
'cpf'
,
'unique:users'
],
'rg'
=>
[
'required'
,
'unique:participantes'
],
'celular'
=>
[
'required'
,
'string'
,
'telefone'
],
'instituicao'
=>
[
'required_if:instituicaoSelect,Outra'
,
'max:255'
],
'instituicaoSelect'
=>
[
'required_without:instituicao'
],
'outroCursoEstudante'
=>
[
'required_if:cursoEstudante,Outro'
,
'max:255'
],
'cursoEstudante'
=>
[
'required_without:outroCursoEstudante'
],
'perfil'
=>
[
'required'
],
'linkLattes'
=>
[
'required'
],
]);
}
else
{
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
...
...
@@ -126,6 +110,24 @@ class UserController extends Controller
]);
}
if
(
$user
->
tipo
==
'participante'
)
{
$validated
=
$request
->
validate
([
'name'
=>
[
'required'
,
'string'
,
'max:255'
],
'email'
=>
[
'required_if:alterarSenhaCheckBox,on'
,
'string'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)
->
ignore
(
$user
->
id
)],
'password'
=>
[
'required_if:alterarSenhaCheckBox,on'
,
'string'
,
'min:8'
,
'confirmed'
],
'cpf'
=>
[
'required'
,
'cpf'
,
Rule
::
unique
(
'users'
)
->
ignore
(
$user
->
id
)],
'rg'
=>
[
'required'
,
Rule
::
unique
(
'participantes'
)
->
ignore
(
$user
->
participantes
->
first
()
->
id
)],
'celular'
=>
[
'required'
,
'string'
,
'telefone'
],
'instituicao'
=>
[
'required_if:instituicaoSelect,Outra'
,
'max:255'
],
'instituicaoSelect'
=>
[
'required_without:instituicao'
],
'outroCursoEstudante'
=>
[
'required_if:cursoEstudante,Outro'
,
'max:255'
],
'cursoEstudante'
=>
[
'required_without:outroCursoEstudante'
],
'perfil'
=>
[
'required'
],
'linkLattes'
=>
[
'required'
,
'url'
],
]);
}
if
(
$request
->
alterarSenhaCheckBox
!=
null
)
{
if
(
!
(
Hash
::
check
(
$request
->
senha_atual
,
$user
->
password
)))
{
return
redirect
()
->
back
()
->
withErrors
([
'senha_atual'
=>
'Senha atual não correspondente'
]);
...
...
@@ -290,5 +292,5 @@ class UserController extends Controller
'cursoPart'
=>
$cursoPart
,
'areaTematica'
=>
$areaTematica
]);
}
}
}
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