Commit 3b402fed authored by Bruno Araujo's avatar Bruno Araujo

Treinamento - 08/20

parent 9185053e
......@@ -20,23 +20,13 @@
</component>
<component name="ChangeListManager">
<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$/app/Http/Controllers/CategoriaController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/CategoriaController.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/Console/Kernel.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Console/Kernel.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_prod.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose_prod.yml" 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$/resources/views/produto/edit.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/produto/edit.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$/uema/BaseRepository.php" beforeDir="false" afterPath="$PROJECT_DIR$/uema/BaseRepository.php" afterDir="false" />
</list>
......@@ -215,6 +205,8 @@
<updated>1601556062055</updated>
<workItem from="1601556063316" duration="6070000" />
<workItem from="1601987693392" duration="7404000" />
<workItem from="1602077915136" duration="39000" />
<workItem from="1602077975731" duration="5666000" />
</task>
<task id="LOCAL-00001" summary="Atualizacao final README.md">
<created>1601565098636</created>
......@@ -246,14 +238,14 @@
<option name="LAST_COMMIT_MESSAGE" value="Atualizacao final README.md" />
</component>
<component name="WindowStateProjectService">
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1601995350337">
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1602165591180">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1601995350337" />
<state x="469" y="179" key="SettingsEditor" timestamp="1601990678797">
<state x="698" y="302" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1602165591180" />
<state x="469" y="179" key="SettingsEditor" timestamp="1602164584994">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="469" y="179" key="SettingsEditor/0.0.1920.1080@0.0.1920.1080" timestamp="1601990678797" />
<state x="469" y="179" key="SettingsEditor/0.0.1920.1080@0.0.1920.1080" timestamp="1602164584994" />
<state x="560" y="280" key="Vcs.Push.Dialog.v2" timestamp="1601565102812">
<screen x="0" y="0" width="1920" height="1080" />
</state>
......
<?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;
}
}
......@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
'App\Console\Commands\TesteCommand'
];
/**
......@@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('invoque:uema')->dailyAt('00:00');
}
/**
......
......@@ -38,4 +38,16 @@ class ProdutoController extends Controller
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'));
}
}
......@@ -33,7 +33,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
/*\Illuminate\Session\Middleware\AuthenticateSession::class, */
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
......@@ -62,5 +62,6 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'ehAdmin' => \App\Http\Middleware\EhAdmin::class,
];
}
<?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();
}
}
......@@ -83,7 +83,7 @@ return [
|
*/
'layout_topnav' => null,
'layout_topnav' => true,
'layout_boxed' => null,
'layout_fixed_sidebar' => null,
'layout_fixed_navbar' => null,
......
......@@ -67,7 +67,7 @@ services:
- app-network
#composer
composerbruno:
composer:
image: composer:latest
container_name: treinamento_composer
volumes:
......
<h1>EDIT DE PRODUTO</h1>
@extends('adminlte::page')
{!! Form::model($produto, ["route" => 'produto.edit', "method" => "PUT"]) !!}
{!! Form::hidden('id', $produto->id) !!}
@section('content')
<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') !!}
{!! Form::close() !!}
@include('produto.includes.form')
{!! Form::submit('ATUALIZAR') !!}
{!! Form::close() !!}
</div>
@stop
......@@ -2,28 +2,28 @@
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
Route::get('/', function () { return view('welcome'); });
Route::group(['prefix' => 'categoria'], function () {
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');
});
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::group(['middleware' => 'auth'], function() {
Route::group(['prefix' => 'categoria', 'middleware' => 'ehAdmin'], function () {
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');
});
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');
});
......@@ -47,9 +47,9 @@ class BaseRepository
return $this->model->all();
}
public function lists($identifier, $field, $sort = 'desc')
public function lists($identifier, $field, $sort = 'asc')
{
return $this->model->orderBy($identifier, $sort)->pluck($field, $identifier);
return $this->model->orderBy($field, $sort)->pluck($field, $identifier);
}
public function find($id) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment