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
pad-upe
Commits
e63111eb
Commit
e63111eb
authored
Mar 28, 2022
by
alissonalbuquerque
Browse files
add atualizações na tela de 'atulizar perfil de usuario'
parent
32e10e2a
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/UserController.php
View file @
e63111eb
...
@@ -30,4 +30,20 @@ class UserController extends Controller
...
@@ -30,4 +30,20 @@ class UserController extends Controller
return
redirect
()
->
route
(
'edit_perfil'
)
->
with
(
'success'
,
'Salvo com sucesso!'
);
return
redirect
()
->
route
(
'edit_perfil'
)
->
with
(
'success'
,
'Salvo com sucesso!'
);
}
}
public
function
updatePassword
(
Request
$request
)
{
$validator
=
User
::
validator
(
$request
->
all
(),
true
);
// if($validator->fails()) {
// return redirect()->back()->withErrors($validator->errors());
// }
// $user = User::find(Auth::user()->id);
// $user->fill($request->all());
// $user->save();
// return redirect()->route('edit_perfil')->with('success', 'Salvo com sucesso!');
}
}
}
app/Models/User.php
View file @
e63111eb
...
@@ -52,13 +52,20 @@ class User extends Authenticatable
...
@@ -52,13 +52,20 @@ class User extends Authenticatable
* Validar os campos de acordo com as regras implementadas
* Validar os campos de acordo com as regras implementadas
*
*
*/
*/
public
static
function
validator
(
$attributes
)
{
public
static
function
validator
(
$attributes
,
$rule_password
=
false
)
{
$rules
=
[
$rules
=
[
'email'
=>
[
'required'
,
'email'
,
],
'email'
=>
[
'required'
,
'email'
,
],
'name'
=>
[
'required'
,
]
'name'
=>
[
'required'
,
]
];
];
if
(
$rule_password
)
{
$rules
=
[
'password'
=>
[
'required'
,
'min:6'
],
'password_confirmation'
=>
[],
];
}
$messages
=
[
$messages
=
[
// 'unique' => "O :attribute já está registrado no sistema",
// 'unique' => "O :attribute já está registrado no sistema",
'required'
=>
"O :attribute precisa ser preenchido"
,
'required'
=>
"O :attribute precisa ser preenchido"
,
...
...
resources/views/user/update_perfil.blade.php
View file @
e63111eb
...
@@ -23,49 +23,91 @@
...
@@ -23,49 +23,91 @@
</
div
>
</
div
>
<
div
class
=
"content"
>
<
div
class
=
"content"
>
<
div
>
<!--
Tab
Panel
-->
<
form
class
=
""
method
=
"post"
action
=
"{{ route('update_perfil') }}"
>
<
div
class
=
"mb-4"
>
@
csrf
<
ul
class
=
"nav nav-tabs"
id
=
"tab-link"
role
=
"tablist"
>
@
method
(
'POST'
)
<
li
class
=
"nav-item"
>
<
div
class
=
""
>
<
a
class
=
"nav-link active"
id
=
"perfil-tab"
data
-
toggle
=
"tab"
href
=
"#perfil"
role
=
"tab"
aria
-
controls
=
"perfil"
aria
-
selected
=
"true"
>
Perfil
</
a
>
<
label
for
=
"email"
>
E
-
mail
</
label
>
</
li
>
<
input
type
=
"email"
class
=
"form-control"
name
=
"email"
id
=
"email"
placeholder
=
"example@email.com"
value
=
"{{ Auth::user()->email }}"
>
<
li
class
=
"nav-item"
>
<
small
id
=
"email_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
<
a
class
=
"nav-link"
id
=
"senha-tab"
data
-
toggle
=
"tab"
href
=
"#senha"
role
=
"tab"
aria
-
controls
=
"senha"
aria
-
selected
=
"false"
>
Senha
</
a
>
@
error
(
'email'
)
</
li
>
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
</
ul
>
@
enderror
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"name"
>
Nome
</
label
>
<
input
type
=
"name"
class
=
"form-control"
name
=
"name"
id
=
"name"
placeholder
=
"Nome Completo"
value
=
"{{ Auth::user()->name }}"
>
<
small
id
=
"name_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'name'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"password"
>
Senha
</
label
>
<
input
type
=
"password"
class
=
"form-control"
name
=
"password"
id
=
"password"
placeholder
=
"Senha"
>
<
small
id
=
"password_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'password'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"document"
>
CPF
</
label
>
<
input
type
=
"document"
class
=
"form-control"
name
=
"document"
id
=
"document"
placeholder
=
"Senha"
value
=
"{{ Auth::user()->document }}"
>
<
small
id
=
"document_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'document'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"d-flex justify-content-end"
>
<
button
class
=
"btn btn-success"
type
=
"submit"
>
Atualizar
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
<!--
Tab
Content
-->
<
div
class
=
"tab-content"
id
=
"tab-content"
>
<!--
Perfil
-->
<
div
class
=
"tab-pane fade show active"
id
=
"perfil"
role
=
"tabpanel"
aria
-
labelledby
=
"perfil-tab"
>
<
form
class
=
""
method
=
"post"
action
=
"{{ route('update_perfil') }}"
>
@
csrf
@
method
(
'POST'
)
<
div
class
=
"form-group"
>
<
label
for
=
"email"
>
E
-
mail
</
label
>
<
input
type
=
"email"
class
=
"form-control"
name
=
"email"
id
=
"email"
placeholder
=
"example@email.com"
value
=
"{{ Auth::user()->email }}"
>
<
small
id
=
"email_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'email'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"name"
>
Nome
</
label
>
<
input
type
=
"name"
class
=
"form-control"
name
=
"name"
id
=
"name"
placeholder
=
"Nome Completo"
value
=
"{{ Auth::user()->name }}"
>
<
small
id
=
"name_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'name'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"form-group"
>
<
label
for
=
"document"
>
CPF
</
label
>
<
input
type
=
"document"
class
=
"form-control"
name
=
"document"
id
=
"document"
placeholder
=
"Senha"
value
=
"{{ Auth::user()->document }}"
>
<
small
id
=
"document_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'document'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"d-flex justify-content-end"
>
<
button
class
=
"btn btn-success"
type
=
"submit"
>
Atualizar
</
button
>
</
div
>
</
form
>
</
div
>
<!--
Senha
-->
<
div
class
=
"tab-pane fade"
id
=
"senha"
role
=
"tabpanel"
aria
-
labelledby
=
"senha-tab"
>
<
form
method
=
"post"
action
=
"{{ route('update_password') }}"
>
@
csrf
@
method
(
'POST'
)
<
div
class
=
"row"
>
<
div
class
=
"col-6"
>
<
div
class
=
"form-group"
>
<
label
for
=
"password"
>
Senha
</
label
>
<
input
type
=
"password"
class
=
"form-control"
name
=
"password"
id
=
"password"
placeholder
=
"Senha"
>
<
small
id
=
"password_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'password'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
</
div
>
<
div
class
=
"col-6"
>
<
div
class
=
"form-group"
>
<
label
for
=
"password_confirmation"
>
Confirmar
Senha
</
label
>
<
input
type
=
"password_confirmation"
class
=
"form-control"
name
=
"password_confirmation"
id
=
"password_confirmation"
placeholder
=
"Senha"
>
<
small
id
=
"password_confirmation_information"
class
=
"form-text text-muted"
>
{{
--
--
}}
</
small
>
@
error
(
'password_confirmation'
)
<
span
class
=
"text-danger"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
</
div
>
</
div
>
<
div
class
=
"d-flex justify-content-end"
>
<
button
class
=
"btn btn-success"
type
=
"submit"
>
Atualizar
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
@
endsection
@
endsection
routes/web.php
View file @
e63111eb
...
@@ -78,6 +78,7 @@ Route::delete('/pad/dimensao/ensino/aula/delete/{id}', [EnsinoAulaController::cl
...
@@ -78,6 +78,7 @@ Route::delete('/pad/dimensao/ensino/aula/delete/{id}', [EnsinoAulaController::cl
Route
::
get
(
'/user/edit/perfil'
,
[
UserController
::
class
,
'editPerfil'
])
->
name
(
'edit_perfil'
);
Route
::
get
(
'/user/edit/perfil'
,
[
UserController
::
class
,
'editPerfil'
])
->
name
(
'edit_perfil'
);
Route
::
post
(
'/user/update/perfil'
,
[
UserController
::
class
,
'updatePerfil'
])
->
name
(
'update_perfil'
);
Route
::
post
(
'/user/update/perfil'
,
[
UserController
::
class
,
'updatePerfil'
])
->
name
(
'update_perfil'
);
Route
::
post
(
'/user/update/password'
,
[
UserController
::
class
,
'updatePassword'
])
->
name
(
'update_password'
);
/** json */
/** json */
Route
::
get
(
'/disciplina/{curso_id}'
,
[
DisciplinaController
::
class
,
'getDisciplinaByCurso'
])
->
name
(
'get_disciplina_by_curso'
);
Route
::
get
(
'/disciplina/{curso_id}'
,
[
DisciplinaController
::
class
,
'getDisciplinaByCurso'
])
->
name
(
'get_disciplina_by_curso'
);
\ No newline at end of file
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