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
4858284f
Commit
4858284f
authored
May 25, 2020
by
carlos
Browse files
crud grande area
parent
557b974a
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/GrandeAreaController.php
0 → 100644
View file @
4858284f
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\GrandeArea
;
class
GrandeAreaController
extends
Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public
function
index
()
{
$grandesAreas
=
GrandeArea
::
orderBy
(
'nome'
)
->
get
();
return
view
(
'naturezas.grandeArea.index'
)
->
with
([
'grandesAreas'
=>
$grandesAreas
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public
function
create
()
{
return
view
(
'naturezas.grandeArea.nova_grande_area'
);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public
function
store
(
Request
$request
)
{
$validatedData
=
$request
->
validate
([
'nome'
=>
'required'
,
]);
$GrandeArea
=
new
GrandeArea
();
$GrandeArea
->
nome
=
$request
->
nome
;
$GrandeArea
->
save
();
return
redirect
(
route
(
'grandearea.index'
)
)
->
with
([
'mensagem'
=>
'Grande área cadastrada com sucesso'
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
show
(
$id
)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
edit
(
$id
)
{
$grandeArea
=
GrandeArea
::
find
(
$id
);
return
view
(
'naturezas.grandeArea.editar_grande_area'
)
->
with
([
'grandeArea'
=>
$grandeArea
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
update
(
Request
$request
,
$id
)
{
$grandeArea
=
GrandeArea
::
find
(
$id
);
$grandeArea
->
nome
=
$request
->
nome
;
$grandeArea
->
update
();
return
redirect
(
route
(
'grandearea.index'
)
)
->
with
([
'mensagem'
=>
'Grande área editada com sucesso'
]);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
$id
)
{
$grandeArea
=
GrandeArea
::
find
(
$id
);
$grandeArea
->
delete
();
return
redirect
(
route
(
'grandearea.index'
)
)
->
with
([
'mensagem'
=>
'Grande área excluida com sucesso'
]);
}
}
\ No newline at end of file
resources/views/layouts/app.blade.php
View file @
4858284f
...
...
@@ -57,10 +57,7 @@
@endif
@else
<!-- Se o usuário for um aluno -->
@if(Auth::user()->tipo == 'administrador')
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{route('visualizarEvento')}}"
>
Início
</a>
</li>
@if(Auth::user()->tipo == 'administrador')
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{ route('admin.naturezas') }}"
>
Naturezas
</a>
...
...
@@ -107,9 +104,6 @@
{{-- Pro-reitor --}}
@if(Auth::user()->tipo == 'administradorResponsavel')
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{route('visualizarEvento')}}"
>
Início
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{route('evento.listar')}}"
>
Editais
</a>
...
...
@@ -148,9 +142,7 @@
@endif
@if(Auth::user()->tipo == 'coordenador')
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{route('visualizarEvento')}}"
>
Início
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{route('coordenador.editais')}}"
>
Meus Editais
</a>
</li>
...
...
@@ -188,38 +180,17 @@
@endif
@if(Auth::user()->tipo == 'proponente')
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{{route('visualizarEvento')}}"
>
Início
</a>
</li>
<li
class=
"nav-item dropdown"
>
<a
id=
"navbarDropdown"
class=
"nav-link dropdown-toggle"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
v-pre
>
{{ Auth::user()->name }}
<span
class=
"caret"
></span>
<a
class=
"nav-link"
href=
"{{ route('logout') }}"
onclick=
"event.preventDefault();
document.getElementById('logout-form').submit();"
>
Sair
</a>
<div
class=
"dropdown-menu dropdown-menu-right"
aria-labelledby=
"navbarDropdown"
>
<a
class=
"dropdown-item"
href=
"{{ route('admin.index') }}"
>
<img
src=
"{{asset('img/icons/perfil.svg')}}"
alt=
""
>
{{ __('Minha Conta') }}
</a>
<a
class=
"dropdown-item"
href=
"{{ route('user.meusTrabalhos') }}"
>
<img
src=
"{{asset('img/icons/file-alt-regular-black.svg')}}"
alt=
""
>
{{ __('Participante') }}
</a>
<a
class=
"dropdown-item"
href=
"{{ route('logout') }}"
onclick=
"event.preventDefault();
document.getElementById('logout-form').submit();"
>
<img
src=
"{{asset('img/icons/sign-out-alt-solid.svg')}}"
alt=
""
>
{{ __('Sair') }}
</a>
<form
id=
"logout-form"
action=
"{{ route('logout') }}"
method=
"POST"
style=
"display: none;"
>
@csrf
</form>
</div>
<form
id=
"logout-form"
action=
"{{ route('logout') }}"
method=
"POST"
style=
"display: none;"
>
@csrf
</form>
</li>
@endif
@if(Auth::user()->tipo == 'participante')
...
...
@@ -254,11 +225,9 @@
{{--
<li
class=
"nav-item dropdown"
>
<a
id=
"navbarDropdown"
class=
"nav-link dropdown-toggle"
href=
"#"
role=
"button"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
v-pre
>
{{ Auth::user()->name }}
<span
class=
"caret"
></span>
</a>
<div
class=
"dropdown-menu dropdown-menu-right"
aria-labelledby=
"navbarDropdown"
>
<a
class=
"dropdown-item"
href=
"{{ route('perfil') }}"
>
<img
src=
"{{asset('img/icons/perfil.svg')}}"
alt=
""
>
...
...
@@ -274,8 +243,6 @@
<img
src=
"{{asset('img/icons/sign-out-alt-solid.svg')}}"
alt=
""
>
{{ __('Sair') }}
</a>
<form
id=
"logout-form"
action=
"{{ route('logout') }}"
method=
"POST"
style=
"display: none;"
>
@csrf
</form>
...
...
@@ -302,4 +269,4 @@
@endif
</body>
</html>
</html>
\ No newline at end of file
resources/views/naturezas/grandeArea/editar_grande_area.blade.php
0 → 100644
View file @
4858284f
@
extends
(
'layouts.app'
)
@
section
(
'content'
)
<
div
class
=
"container"
>
<
div
class
=
"row"
>
<
div
class
=
"col-sm-12"
>
<
h2
style
=
"margin-top: 100px; "
>
{{
__
(
'Editar uma Grande área'
)
}}
</
h2
>
</
div
>
</
div
>
<
div
class
=
"row"
>
<
form
method
=
"POST"
action
=
"{{ route('grandearea.atualizar', ['id' =>
$grandeArea->id
])}}"
>
@
csrf
<
div
class
=
"col-sm-12"
>
<
label
for
=
"nome"
class
=
"col-form-label"
>
{{
__
(
'Nome'
)
}}
</
label
>
<
input
id
=
"nome"
type
=
"text"
class
=
"form-control @error('nome') is-invalid @enderror"
name
=
"nome"
value
=
"{{
$grandeArea->nome
}}"
required
autocomplete
=
"nome"
autofocus
>
@
error
(
'nome'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
<
button
href
=
"
{
{route('evento.criar')}
}
"
class
=
"btn btn-primary"
style
=
"position:relative;top:100px;"
>
{{
__
(
'Salvar'
)
}}
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
@
endsection
\ No newline at end of file
resources/views/naturezas/grandeArea/index.blade.php
View file @
4858284f
...
...
@@ -2,8 +2,63 @@
@
section
(
'content'
)
<
div
class
=
"container"
>
<
div
class
=
"container"
>
<
div
class
=
"row"
>
@
if
(
session
(
'mensagem'
))
<
div
class
=
"col-md-12"
style
=
"margin-top: 100px;"
>
<
div
class
=
"alert alert-success"
>
<
p
>
{{
session
(
'mensagem'
)}}
</
p
>
</
div
>
</
div
>
@
endif
<
div
class
=
"col-sm-9"
>
<
h2
style
=
"margin-top: 100px; "
>
{{
__
(
'Grandes Áreas'
)
}}
</
h2
>
</
div
>
<
div
class
=
"col-sm-3"
>
<
a
href
=
"
{
{route('grandearea.criar')}
}
"
class
=
"btn btn-primary"
style
=
"position:relative;top:100px;"
>
{{
__
(
'Criar Grande Área'
)
}}
</
a
>
</
div
>
</
div
>
<
hr
>
<
table
class
=
"table table-bordered"
>
<
thead
>
<
tr
>
<
th
scope
=
"col"
>
Nome
</
th
>
<
th
scope
=
"col"
>
Opção
</
th
>
</
tr
>
</
thead
>
<
tbody
>
@
foreach
(
$grandesAreas
as
$grandeArea
)
<
tr
>
<
td
>
<
a
href
=
""
class
=
"visualizarEvento"
>
{{
$grandeArea
->
nome
}}
</
a
>
</
td
>
<
td
>
<
div
class
=
"btn-group dropright dropdown-options"
>
<
a
id
=
"options"
class
=
"dropdown-toggle "
data
-
toggle
=
"dropdown"
aria
-
haspopup
=
"true"
aria
-
expanded
=
"false"
>
</
a
>
<
div
class
=
"dropdown-menu"
>
<
a
href
=
"{{ route('grandearea.editar', ['id' =>
$grandeArea->id
]) }}"
class
=
"dropdown-item"
>
<
img
src
=
"
{
{asset('img/icons/edit-regular.svg')}
}
"
class
=
"icon-card"
alt
=
""
>
Editar
</
a
>
<
form
method
=
"POST"
action
=
"{{ route('grandearea.deletar', ['id' =>
$grandeArea->id
]) }}"
>
{{
csrf_field
()
}}
<
button
type
=
"submit"
class
=
"dropdown-item"
>
<
img
src
=
"
{
{asset('img/icons/trash-alt-regular.svg')}
}
"
class
=
"icon-card"
alt
=
""
>
Deletar
</
button
>
</
form
>
</
div
>
</
div
>
</
td
>
</
tr
>
@
endforeach
</
tbody
>
</
table
>
</
div
>
@
endsection
\ No newline at end of file
resources/views/naturezas/grandeArea/nova_grande_area.blade.php
0 → 100644
View file @
4858284f
@
extends
(
'layouts.app'
)
@
section
(
'content'
)
<
div
class
=
"container"
>
<
div
class
=
"row"
>
<
div
class
=
"col-sm-12"
>
<
h2
style
=
"margin-top: 100px; "
>
{{
__
(
'Criar uma nova Grande Área'
)
}}
</
h2
>
</
div
>
</
div
>
<
div
class
=
"row"
>
<
form
method
=
"POST"
action
=
"{{ route('grandearea.salvar')}}"
>
@
csrf
<
div
class
=
"col-sm-12"
>
<
label
for
=
"nome"
class
=
"col-form-label"
>
{{
__
(
'Nome'
)
}}
</
label
>
<
input
id
=
"nome"
type
=
"text"
class
=
"form-control @error('nome') is-invalid @enderror"
name
=
"nome"
value
=
"{{ old('nome') }}"
required
autocomplete
=
"nome"
autofocus
>
@
error
(
'nome'
)
<
span
class
=
"invalid-feedback"
role
=
"alert"
>
<
strong
>
{{
$message
}}
</
strong
>
</
span
>
@
enderror
<
button
href
=
"
{
{route('evento.criar')}
}
"
class
=
"btn btn-primary"
style
=
"position:relative;top:100px;"
>
{{
__
(
'Salvar'
)
}}
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
@
endsection
\ No newline at end of file
resources/views/naturezas/index.blade.php
View file @
4858284f
...
...
@@ -4,18 +4,18 @@
<
div
class
=
"container"
>
<
h2
style
=
"margin-top: 100px; "
>
Administrador
</
h2
>
<
h2
style
=
"margin-top: 100px; "
>
Administrador
</
h2
>
<
div
class
=
"row justify-content-center d-flex align-items-center"
>
<
div
class
=
"col-sm-4 d-flex justify-content-center "
>
<
a
href
=
"
#
"
style
=
"text-decoration:none; color: inherit;"
>
<
a
href
=
"
{{ route('grandearea.index') }}
"
style
=
"text-decoration:none; color: inherit;"
>
<
div
class
=
"card text-center "
style
=
"border-radius: 30px; width: 18rem;"
>
<
div
class
=
"card-body d-flex justify-content-center"
>
<
h2
style
=
"padding-top:15px"
>
Grande
Area
</
h2
>
</
div
>
</
div
>
</
a
>
</
a
>
</
div
>
<
div
class
=
"col-sm-4 d-flex justify-content-center"
>
...
...
@@ -41,4 +41,4 @@
</
div
>
@
endsection
@
endsection
\ No newline at end of file
routes/web.php
View file @
4858284f
...
...
@@ -43,8 +43,16 @@ Route::post('/perfil','UserController@editarPerfil')->name('perfil')->middleware
// Rotas Administrador
Route
::
get
(
'/home-admin'
,
'AdministradorController@index'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'admin.index'
);
Route
::
get
(
'/naturezas'
,
'AdministradorController@naturezas'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'admin.naturezas'
);
Route
::
get
(
'/usuarios'
,
'AdministradorController@usuarios'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'admin.usuarios'
);
//Rotas das naturezas
Route
::
get
(
'/naturezas'
,
'AdministradorController@naturezas'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'admin.naturezas'
);
Route
::
get
(
'/naturezas/grande-area'
,
'GrandeAreaController@index'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'grandearea.index'
);
Route
::
get
(
'/naturezas/grande-area/nova'
,
'GrandeAreaController@create'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'grandearea.criar'
);
Route
::
post
(
'/naturezas/grande-area/salvar'
,
'GrandeAreaController@store'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'grandearea.salvar'
);
Route
::
get
(
'/naturezas/grande-area/editar/{id}'
,
'GrandeAreaController@edit'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'grandearea.editar'
);
Route
::
post
(
'/naturezas/grande-area/atualizar/{id}'
,
'GrandeAreaController@update'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'grandearea.atualizar'
);
Route
::
post
(
'/naturezas/grande-area/excluir/{id}'
,
'GrandeAreaController@destroy'
)
->
middleware
(
'checkAdministrador'
)
->
name
(
'grandearea.deletar'
);
// Rotas Coordenador
Route
::
get
(
'/coordenador/home'
,
'CoordenadorComissaoController@index'
)
->
name
(
'coordenador.index'
);
...
...
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