Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
treinamento_laravel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bruno Araujo
treinamento_laravel
Commits
3b402fed
Commit
3b402fed
authored
Oct 08, 2020
by
Bruno Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treinamento - 08/20
parent
9185053e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
127 additions
and
53 deletions
+127
-53
workspace.xml
.idea/workspace.xml
+11
-19
TesteCommand.php
app/Console/Commands/TesteCommand.php
+43
-0
Kernel.php
app/Console/Kernel.php
+2
-2
ProdutoController.php
app/Http/Controllers/ProdutoController.php
+12
-0
Kernel.php
app/Http/Kernel.php
+2
-1
EhAdmin.php
app/Http/Middleware/EhAdmin.php
+18
-0
adminlte.php
config/adminlte.php
+1
-1
docker-compose.yml
docker-compose.yml
+1
-1
edit.blade.php
resources/views/produto/edit.blade.php
+14
-6
web.php
routes/web.php
+21
-21
BaseRepository.php
uema/BaseRepository.php
+2
-2
No files found.
.idea/workspace.xml
View file @
3b402fed
...
@@ -20,23 +20,13 @@
...
@@ -20,23 +20,13 @@
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"493d567d-53f3-4e20-a1ed-b21775166d2f"
name=
"Default Changelist"
comment=
"Atualizacao final README.md"
>
<list
default=
"true"
id=
"493d567d-53f3-4e20-a1ed-b21775166d2f"
name=
"Default Changelist"
comment=
"Atualizacao final README.md"
>
<change
afterPath=
"$PROJECT_DIR$/app/Http/Controllers/ProdutoController.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/app/Http/Requests/ProdutoRequest.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/app/Models/Produto.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/app/Repositories/ProdutoRepository.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/resources/views/invoque/template.blade.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/resources/views/produto/create.blade.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/resources/views/produto/edit.blade.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/resources/views/produto/includes/form.blade.php"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/resources/views/produto/index.blade.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Http/Controllers/CategoriaController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Controllers/CategoriaController.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Console/Kernel.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Console/Kernel.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Models/Categoria.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Models/Categoria.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Http/Controllers/ProdutoController.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Controllers/ProdutoController.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/app/Http/Kernel.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/app/Http/Kernel.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/config/adminlte.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/config/adminlte.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/docker-compose.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/docker-compose.yml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/docker-compose.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/docker-compose.yml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/docker-compose_prod.yml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/docker-compose_prod.yml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/resources/views/produto/edit.blade.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/resources/views/produto/edit.blade.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/resources/views/categoria/create.blade.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/resources/views/categoria/create.blade.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/resources/views/categoria/includes/form.blade.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/resources/views/categoria/includes/form.blade.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/resources/views/categoria/index.blade.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/resources/views/categoria/index.blade.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/routes/web.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/routes/web.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/routes/web.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/routes/web.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/uema/BaseRepository.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/uema/BaseRepository.php"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/uema/BaseRepository.php"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/uema/BaseRepository.php"
afterDir=
"false"
/>
</list>
</list>
...
@@ -215,6 +205,8 @@
...
@@ -215,6 +205,8 @@
<updated>
1601556062055
</updated>
<updated>
1601556062055
</updated>
<workItem
from=
"1601556063316"
duration=
"6070000"
/>
<workItem
from=
"1601556063316"
duration=
"6070000"
/>
<workItem
from=
"1601987693392"
duration=
"7404000"
/>
<workItem
from=
"1601987693392"
duration=
"7404000"
/>
<workItem
from=
"1602077915136"
duration=
"39000"
/>
<workItem
from=
"1602077975731"
duration=
"5666000"
/>
</task>
</task>
<task
id=
"LOCAL-00001"
summary=
"Atualizacao final README.md"
>
<task
id=
"LOCAL-00001"
summary=
"Atualizacao final README.md"
>
<created>
1601565098636
</created>
<created>
1601565098636
</created>
...
@@ -246,14 +238,14 @@
...
@@ -246,14 +238,14 @@
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"Atualizacao final README.md"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"Atualizacao final README.md"
/>
</component>
</component>
<component
name=
"WindowStateProjectService"
>
<component
name=
"WindowStateProjectService"
>
<state
x=
"698"
y=
"302"
key=
"#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog"
timestamp=
"160
1995350337
"
>
<state
x=
"698"
y=
"302"
key=
"#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog"
timestamp=
"160
2165591180
"
>
<screen
x=
"0"
y=
"0"
width=
"1920"
height=
"1080"
/>
<screen
x=
"0"
y=
"0"
width=
"1920"
height=
"1080"
/>
</state>
</state>
<state
x=
"698"
y=
"302"
key=
"#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1920.1080@0.0.1920.1080"
timestamp=
"160
1995350337
"
/>
<state
x=
"698"
y=
"302"
key=
"#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1920.1080@0.0.1920.1080"
timestamp=
"160
2165591180
"
/>
<state
x=
"469"
y=
"179"
key=
"SettingsEditor"
timestamp=
"160
1990678797
"
>
<state
x=
"469"
y=
"179"
key=
"SettingsEditor"
timestamp=
"160
2164584994
"
>
<screen
x=
"0"
y=
"0"
width=
"1920"
height=
"1080"
/>
<screen
x=
"0"
y=
"0"
width=
"1920"
height=
"1080"
/>
</state>
</state>
<state
x=
"469"
y=
"179"
key=
"SettingsEditor/0.0.1920.1080@0.0.1920.1080"
timestamp=
"160
1990678797
"
/>
<state
x=
"469"
y=
"179"
key=
"SettingsEditor/0.0.1920.1080@0.0.1920.1080"
timestamp=
"160
2164584994
"
/>
<state
x=
"560"
y=
"280"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"1601565102812"
>
<state
x=
"560"
y=
"280"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"1601565102812"
>
<screen
x=
"0"
y=
"0"
width=
"1920"
height=
"1080"
/>
<screen
x=
"0"
y=
"0"
width=
"1920"
height=
"1080"
/>
</state>
</state>
...
...
app/Console/Commands/TesteCommand.php
0 → 100644
View file @
3b402fed
<?php
namespace
App\Console\Commands
;
use
Illuminate\Console\Command
;
class
TesteCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'invoque:teste'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'Esse comando imprime o nome uemna '
;
/**
* Create a new command instance.
*
* @return void
*/
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* Execute the console command.
*
* @return int
*/
public
function
handle
()
{
echo
'UEMA'
;
return
0
;
}
}
app/Console/Kernel.php
View file @
3b402fed
...
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
...
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array
* @var array
*/
*/
protected
$commands
=
[
protected
$commands
=
[
//
'App\Console\Commands\TesteCommand'
];
];
/**
/**
...
@@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
...
@@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
*/
*/
protected
function
schedule
(
Schedule
$schedule
)
protected
function
schedule
(
Schedule
$schedule
)
{
{
// $schedule->command('inspire')->hourly(
);
$schedule
->
command
(
'invoque:uema'
)
->
dailyAt
(
'00:00'
);
}
}
/**
/**
...
...
app/Http/Controllers/ProdutoController.php
View file @
3b402fed
...
@@ -38,4 +38,16 @@ class ProdutoController extends Controller
...
@@ -38,4 +38,16 @@ class ProdutoController extends Controller
return
redirect
()
->
back
();
return
redirect
()
->
back
();
}
}
public
function
getEdit
(
$id
)
{
$produto
=
$this
->
produtoRepository
->
find
(
$id
);
if
(
is_null
(
$produto
))
{
return
redirect
()
->
back
();
}
$categorias
=
$this
->
categoriaRepository
->
lists
(
'id'
,
'nome'
);
return
view
(
'produto.edit'
,
compact
(
'produto'
,
'categorias'
));
}
}
}
app/Http/Kernel.php
View file @
3b402fed
...
@@ -33,7 +33,7 @@ class Kernel extends HttpKernel
...
@@ -33,7 +33,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\EncryptCookies
::
class
,
\App\Http\Middleware\EncryptCookies
::
class
,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse
::
class
,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse
::
class
,
\Illuminate\Session\Middleware\StartSession
::
class
,
\Illuminate\Session\Middleware\StartSession
::
class
,
/
/ \Illuminate\Session\Middleware\AuthenticateSession::class,
/
*\Illuminate\Session\Middleware\AuthenticateSession::class, */
\Illuminate\View\Middleware\ShareErrorsFromSession
::
class
,
\Illuminate\View\Middleware\ShareErrorsFromSession
::
class
,
\App\Http\Middleware\VerifyCsrfToken
::
class
,
\App\Http\Middleware\VerifyCsrfToken
::
class
,
\Illuminate\Routing\Middleware\SubstituteBindings
::
class
,
\Illuminate\Routing\Middleware\SubstituteBindings
::
class
,
...
@@ -62,5 +62,6 @@ class Kernel extends HttpKernel
...
@@ -62,5 +62,6 @@ class Kernel extends HttpKernel
'signed'
=>
\Illuminate\Routing\Middleware\ValidateSignature
::
class
,
'signed'
=>
\Illuminate\Routing\Middleware\ValidateSignature
::
class
,
'throttle'
=>
\Illuminate\Routing\Middleware\ThrottleRequests
::
class
,
'throttle'
=>
\Illuminate\Routing\Middleware\ThrottleRequests
::
class
,
'verified'
=>
\Illuminate\Auth\Middleware\EnsureEmailIsVerified
::
class
,
'verified'
=>
\Illuminate\Auth\Middleware\EnsureEmailIsVerified
::
class
,
'ehAdmin'
=>
\App\Http\Middleware\EhAdmin
::
class
,
];
];
}
}
app/Http/Middleware/EhAdmin.php
0 → 100644
View file @
3b402fed
<?php
namespace
App\Http\Middleware
;
use
Closure
;
use
Illuminate\Http\Request
;
class
EhAdmin
{
public
function
handle
(
Request
$request
,
Closure
$next
)
{
if
(
\Auth
::
user
()
->
name
==
'bruno'
)
{
return
$next
(
$request
);
}
return
redirect
()
->
back
();
}
}
config/adminlte.php
View file @
3b402fed
...
@@ -83,7 +83,7 @@ return [
...
@@ -83,7 +83,7 @@ return [
|
|
*/
*/
'layout_topnav'
=>
null
,
'layout_topnav'
=>
true
,
'layout_boxed'
=>
null
,
'layout_boxed'
=>
null
,
'layout_fixed_sidebar'
=>
null
,
'layout_fixed_sidebar'
=>
null
,
'layout_fixed_navbar'
=>
null
,
'layout_fixed_navbar'
=>
null
,
...
...
docker-compose.yml
View file @
3b402fed
...
@@ -67,7 +67,7 @@ services:
...
@@ -67,7 +67,7 @@ services:
-
app-network
-
app-network
#composer
#composer
composer
bruno
:
composer
:
image
:
composer:latest
image
:
composer:latest
container_name
:
treinamento_composer
container_name
:
treinamento_composer
volumes
:
volumes
:
...
...
resources/views/produto/edit.blade.php
View file @
3b402fed
<h1>
EDIT DE PRODUTO
</h1>
@
extends
(
'adminlte::page'
)
{!! Form::model($produto, ["route" => 'produto.edit', "method" => "PUT"]) !!}
@
section
(
'content'
)
{!! Form::hidden('id', $produto->id) !!}
<
div
class
=
"card card-primary"
>
<
div
class
=
"card-header"
>
<
h3
class
=
"card-title"
>
Editar
produto
</
h3
>
</
div
>
@include('produto.includes.form')
{
!!
Form
::
model
(
$produto
,
[
"route"
=>
'produto.edit'
,
"method"
=>
"PUT"
])
!!
}
{
!!
Form
::
hidden
(
'id'
,
$produto
->
id
)
!!
}
{!! Form::submit('ATUALIZAR') !!}
@
include
(
'produto.includes.form'
)
{!! Form::close() !!}
{
!!
Form
::
submit
(
'ATUALIZAR'
)
!!
}
{
!!
Form
::
close
()
!!
}
</
div
>
@
stop
routes/web.php
View file @
3b402fed
...
@@ -2,28 +2,28 @@
...
@@ -2,28 +2,28 @@
use
Illuminate\Support\Facades\Route
;
use
Illuminate\Support\Facades\Route
;
Route
::
get
(
'/'
,
function
()
{
Route
::
get
(
'/'
,
function
()
{
return
view
(
'welcome'
);
});
return
view
(
'welcome'
);
});
Route
::
group
([
'prefix'
=>
'categoria'
],
function
()
{
Auth
::
routes
();
Route
::
get
(
'/'
,
'CategoriaController@getIndex'
)
->
name
(
'categoria.index'
);
Route
::
get
(
'/create'
,
'CategoriaController@getCreate'
)
->
name
(
'categoria.create'
);
Route
::
post
(
'/create'
,
'CategoriaController@postCreate'
)
->
name
(
'categoria.create'
);
Route
::
get
(
'/edit/{id}'
,
'CategoriaController@getEdit'
)
->
name
(
'categoria.edit'
);
Route
::
put
(
'/edit'
,
'CategoriaController@putEdit'
)
->
name
(
'categoria.edit'
);
Route
::
get
(
'/delete/{id}'
,
'CategoriaController@getDelete'
)
->
name
(
'categoria.delete'
);
});
Route
::
group
([
'prefix'
=>
'produto'
],
function
()
{
Route
::
group
([
'middleware'
=>
'auth'
],
function
()
{
Route
::
get
(
'/'
,
'ProdutoController@getIndex'
)
->
name
(
'produto.index'
);
Route
::
group
([
'prefix'
=>
'categoria'
,
'middleware'
=>
'ehAdmin'
],
function
()
{
Route
::
get
(
'/create'
,
'ProdutoController@getCreate'
)
->
name
(
'produto.create'
);
Route
::
get
(
'/'
,
'CategoriaController@getIndex'
)
->
name
(
'categoria.index'
);
Route
::
post
(
'/create'
,
'ProdutoController@postCreate'
)
->
name
(
'produto.create'
);
Route
::
get
(
'/create'
,
'CategoriaController@getCreate'
)
->
name
(
'categoria.create'
);
Route
::
get
(
'/edit/{id}'
,
'ProdutoController@getEdit'
)
->
name
(
'produto.edit'
);
Route
::
post
(
'/create'
,
'CategoriaController@postCreate'
)
->
name
(
'categoria.create'
);
Route
::
put
(
'/edit'
,
'ProdutoController@putEdit'
)
->
name
(
'produto.edit'
);
Route
::
get
(
'/edit/{id}'
,
'CategoriaController@getEdit'
)
->
name
(
'categoria.edit'
);
Route
::
get
(
'/delete/{id}'
,
'ProdutoController@getDelete'
)
->
name
(
'produto.delete'
);
Route
::
put
(
'/edit'
,
'CategoriaController@putEdit'
)
->
name
(
'categoria.edit'
);
});
Route
::
get
(
'/delete/{id}'
,
'CategoriaController@getDelete'
)
->
name
(
'categoria.delete'
);
});
Auth
::
routes
();
Route
::
group
([
'prefix'
=>
'produto'
],
function
()
{
Route
::
get
(
'/'
,
'ProdutoController@getIndex'
)
->
name
(
'produto.index'
);
Route
::
get
(
'/create'
,
'ProdutoController@getCreate'
)
->
name
(
'produto.create'
);
Route
::
post
(
'/create'
,
'ProdutoController@postCreate'
)
->
name
(
'produto.create'
);
Route
::
get
(
'/edit/{id}'
,
'ProdutoController@getEdit'
)
->
name
(
'produto.edit'
);
Route
::
put
(
'/edit'
,
'ProdutoController@putEdit'
)
->
name
(
'produto.edit'
);
Route
::
get
(
'/delete/{id}'
,
'ProdutoController@getDelete'
)
->
name
(
'produto.delete'
);
});
Route
::
get
(
'/home'
,
[
App\Http\Controllers\HomeController
::
class
,
'index'
])
->
name
(
'home'
);
Route
::
get
(
'/home'
,
[
App\Http\Controllers\HomeController
::
class
,
'index'
])
->
name
(
'home'
);
});
uema/BaseRepository.php
View file @
3b402fed
...
@@ -47,9 +47,9 @@ class BaseRepository
...
@@ -47,9 +47,9 @@ class BaseRepository
return
$this
->
model
->
all
();
return
$this
->
model
->
all
();
}
}
public
function
lists
(
$identifier
,
$field
,
$sort
=
'
de
sc'
)
public
function
lists
(
$identifier
,
$field
,
$sort
=
'
a
sc'
)
{
{
return
$this
->
model
->
orderBy
(
$
identifier
,
$sort
)
->
pluck
(
$field
,
$identifier
);
return
$this
->
model
->
orderBy
(
$
field
,
$sort
)
->
pluck
(
$field
,
$identifier
);
}
}
public
function
find
(
$id
)
{
public
function
find
(
$id
)
{
...
...
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