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
062d3d34
Commit
062d3d34
authored
Mar 28, 2022
by
alissonalbuquerque
Browse files
atualizacoes de final de semana
parent
2c0e9076
Changes
10
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/UserController.php
0 → 100644
View file @
062d3d34
<?php
namespace
App\Http\Controllers
;
use
App\Models\User
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
class
UserController
extends
Controller
{
const
MENU_UPDATE_PERFIL
=
0
;
public
function
editPerfil
()
{
return
view
(
'user.update_perfil'
,
[
'index_menu'
=>
self
::
MENU_UPDATE_PERFIL
]);
}
public
function
updatePerfil
(
Request
$request
)
{
$validator
=
User
::
validator
(
$request
->
all
());
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 @
062d3d34
...
@@ -6,6 +6,8 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
...
@@ -6,6 +6,8 @@ use Illuminate\Contracts\Auth\MustVerifyEmail;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Foundation\Auth\User
as
Authenticatable
;
use
Illuminate\Notifications\Notifiable
;
use
Illuminate\Notifications\Notifiable
;
use
Illuminate\Support\Facades\Validator
;
use
Illuminate\Validation\ValidationException
;
use
Laravel\Sanctum\HasApiTokens
;
use
Laravel\Sanctum\HasApiTokens
;
class
User
extends
Authenticatable
class
User
extends
Authenticatable
...
@@ -46,6 +48,30 @@ class User extends Authenticatable
...
@@ -46,6 +48,30 @@ class User extends Authenticatable
'email_verified_at'
=>
'datetime'
'email_verified_at'
=>
'datetime'
];
];
/**
* Validar os campos de acordo com as regras implementadas
*
*/
public
static
function
validator
(
$attributes
)
{
$rules
=
[
'email'
=>
[
'required'
,
'email'
,
],
'name'
=>
[
'required'
,
]
];
$messages
=
[
// 'unique' => "O :attribute já está registrado no sistema",
'required'
=>
"O :attribute precisa ser preenchido"
,
];
try
{
return
Validator
::
make
(
$attributes
,
$rules
,
$messages
);
}
catch
(
ValidationException
$exception
)
{
}
}
/**
/**
* Get Curso with curso.id = user.curso_id
* Get Curso with curso.id = user.curso_id
*
*
...
@@ -102,5 +128,4 @@ class User extends Authenticatable
...
@@ -102,5 +128,4 @@ class User extends Authenticatable
{
{
return
$this
->
name
;
return
$this
->
name
;
}
}
}
}
resources/views/components/alerts.blade.php
0 → 100644
View file @
062d3d34
@
if
(
Session
::
has
(
'success'
)
)
<
div
class
=
"alert alert-success alert-dismissible fade show"
role
=
"alert"
>
{{
Session
::
get
(
'success'
)
}}
<
button
type
=
"button"
class
=
"close"
data
-
dismiss
=
"alert"
aria
-
label
=
"Close"
>
<
span
aria
-
hidden
=
"true"
>&
times
;
</
span
>
</
button
>
</
div
>
@
endif
@
if
(
Session
::
has
(
'fail'
)
)
<
div
class
=
"alert alert-danger alert-dismissible fade show"
role
=
"alert"
>
{{
Session
::
get
(
'fail'
)
}}
<
button
type
=
"button"
class
=
"close"
data
-
dismiss
=
"alert"
aria
-
label
=
"Close"
>
<
span
aria
-
hidden
=
"true"
>&
times
;
</
span
>
</
button
>
</
div
>
@
endif
@
if
(
Session
::
has
(
'error'
)
)
<
div
class
=
"alert alert-danger alert-dismissible fade show"
role
=
"alert"
>
{{
Session
::
get
(
'error'
)
}}
<
button
type
=
"button"
class
=
"close"
data
-
dismiss
=
"alert"
aria
-
label
=
"Close"
>
<
span
aria
-
hidden
=
"true"
>&
times
;
</
span
>
</
button
>
</
div
>
@
endif
resources/views/dashboard.blade.php
View file @
062d3d34
<x-app-layout>
<x-app-layout>
@section('title', 'Home')
<x-slot
name=
"main"
>
<x-slot
name=
"main"
>
<div
class=
"tab-content"
>
<div
class=
"tab-content"
>
@if(Auth::check())
@include('layouts.user-dashboard.update_perfil', ['user' => Auth::user()])
@endif
@if(Auth::user()->isTypeAdmin())
@if(Auth::user()->isTypeAdmin())
@include('layouts.user-dashboard.dashboard_admin')
@include('layouts.user-dashboard.dashboard_admin')
@endif
@endif
...
@@ -20,7 +17,6 @@
...
@@ -20,7 +17,6 @@
@if(Auth::user()->isTypeCoordinator())
@if(Auth::user()->isTypeCoordinator())
@include('layouts.user-dashboard.dashboard_coordinator')
@include('layouts.user-dashboard.dashboard_coordinator')
@endif
@endif
</div>
</div>
</x-slot>
</x-slot>
</x-app-layout>
</x-app-layout>
resources/views/layouts/app.blade.php
View file @
062d3d34
...
@@ -6,7 +6,8 @@
...
@@ -6,7 +6,8 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
<title>
{{ config('app.name', 'Laravel') }}
</title>
<title>
{{ config('app.name') }} - @yield('title')
</title>
<!-- Styles -->
<!-- Styles -->
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
...
...
resources/views/layouts/main.blade.php
View file @
062d3d34
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
<title>
{{ config('app.name'
, 'Laravel') }}
</title>
<title>
{{ config('app.name'
) }} - @yield('title')
</title>
<!-- Styles -->
<!-- Styles -->
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
@section('nav')
@section('nav')
@show
@show
<main
class=
""
>
<main
class=
"
container-fluid
"
>
@section('body')
@section('body')
@show
@show
</main>
</main>
...
...
resources/views/layouts/navigation.blade.php
View file @
062d3d34
...
@@ -5,13 +5,9 @@
...
@@ -5,13 +5,9 @@
<div
class=
"d-flex justify-content-center flex-column content-user-info"
>
<div
class=
"d-flex justify-content-center flex-column content-user-info"
>
<div
class=
"font-medium text-base text-gray-800"
>
{{ Auth::user()->name }}
</div>
<div
class=
"font-medium text-base text-gray-800"
>
{{ Auth::user()->name }}
</div>
<div
class=
"font-medium text-sm text-gray-500"
>
{{ Auth::user()->email }}
</div>
<div
class=
"font-medium text-sm text-gray-500"
>
{{ Auth::user()->email }}
</div>
<a
id=
"btn-update-perfil"
class=
"btn"
>
<a
id=
"btn-update-perfil"
class=
"btn"
href=
"{{ route('edit_perfil') }}"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
fill=
"currentColor"
<i
class=
"bi bi-gear"
></i>
class=
"bi bi-gear-fill"
viewBox=
"0 0 16 16"
>
Editar Perfil
<path
d=
"M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"
/>
</svg>
Editar
</a>
</a>
</div>
</div>
</div>
</div>
...
...
resources/views/layouts/user-dashboard/update_perfil.blade.php
deleted
100644 → 0
View file @
2c0e9076
<div
class=
"tab-pane"
id=
"update-perfil"
role=
"tabpanel"
aria-labelledby=
"update-perfil-tab"
>
<div
class=
"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"
>
<h1
class=
"h2"
>
Atualizar Perfil
</h1>
</div>
</div>
\ No newline at end of file
resources/views/user/update_perfil.blade.php
0 → 100644
View file @
062d3d34
@
extends
(
'layouts.main'
)
@
section
(
'title'
,
'Atulizar Perfil'
)
@
section
(
'header'
)
@
include
(
'layouts.header'
,
[
'user'
=>
Auth
::
user
(),
])
@
endsection
@
section
(
'nav'
)
@
include
(
'layouts.navigation'
,
[
'index_menu'
=>
$index_menu
,
])
@
endsection
@
section
(
'body'
)
@
include
(
'components.alerts'
)
<
div
class
=
"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom"
>
<
h1
class
=
"h2"
>
Atualizar
Perfil
</
h1
>
</
div
>
<
div
class
=
"content"
>
<
div
>
<
form
class
=
""
method
=
"post"
action
=
"{{ route('update_perfil') }}"
>
@
csrf
@
method
(
'POST'
)
<
div
class
=
""
>
<
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
=
"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
>
@
endsection
routes/web.php
View file @
062d3d34
...
@@ -11,6 +11,7 @@ use App\Http\Controllers\DisciplinaController;
...
@@ -11,6 +11,7 @@ use App\Http\Controllers\DisciplinaController;
use
App\Http\Controllers\UnidadeController
;
use
App\Http\Controllers\UnidadeController
;
use
App\Http\Controllers\PADController
;
use
App\Http\Controllers\PADController
;
use
App\Http\Controllers\Tabelas\Ensino\EnsinoAulaController
;
use
App\Http\Controllers\Tabelas\Ensino\EnsinoAulaController
;
use
App\Http\Controllers\UserController
;
use
App\Models\Disciplina
;
use
App\Models\Disciplina
;
use
Illuminate\Support\Facades\Route
;
use
Illuminate\Support\Facades\Route
;
...
@@ -75,5 +76,8 @@ Route::get('/pad/dimensao/extensao', [ExtensaoController::class, 'index'])->name
...
@@ -75,5 +76,8 @@ Route::get('/pad/dimensao/extensao', [ExtensaoController::class, 'index'])->name
Route
::
post
(
'/pad/dimensao/ensino/aula/create'
,
[
EnsinoAulaController
::
class
,
'create'
])
->
name
(
'ensino_aula_create'
);
Route
::
post
(
'/pad/dimensao/ensino/aula/create'
,
[
EnsinoAulaController
::
class
,
'create'
])
->
name
(
'ensino_aula_create'
);
Route
::
delete
(
'/pad/dimensao/ensino/aula/delete/{id}'
,
[
EnsinoAulaController
::
class
,
'delete'
])
->
name
(
'ensino_aula_delete'
);
Route
::
delete
(
'/pad/dimensao/ensino/aula/delete/{id}'
,
[
EnsinoAulaController
::
class
,
'delete'
])
->
name
(
'ensino_aula_delete'
);
Route
::
get
(
'/user/edit/perfil'
,
[
UserController
::
class
,
'editPerfil'
])
->
name
(
'edit_perfil'
);
Route
::
post
(
'/user/update/perfil'
,
[
UserController
::
class
,
'updatePerfil'
])
->
name
(
'update_perfil'
);
/** 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