├── public ├── favicon.ico ├── robots.txt ├── .DS_Store ├── assets │ ├── .DS_Store │ └── images │ │ └── login-background.jpg ├── .htaccess ├── web.config ├── index.php └── css │ └── stylesheet.css ├── database ├── .gitignore ├── seeds │ └── DatabaseSeeder.php ├── migrations │ ├── 2017_11_13_005714_create_instituitions_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2017_11_19_023804_create_groups_table.php │ ├── 2017_12_27_011812_create_products_table.php │ ├── 2017_11_28_015355_create_user_groups_table.php │ ├── 2018_01_24_164217_create_moviments_table.php │ ├── 2017_03_22_231714_create_user_socials_table.php │ └── 2017_03_15_002140_create_users_table.php └── factories │ └── ModelFactory.php ├── bootstrap ├── cache │ └── .gitignore ├── autoload.php └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── cache │ └── .gitignore │ ├── views │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── resources ├── views │ ├── vendor │ │ ├── mail │ │ │ ├── markdown │ │ │ │ ├── panel.blade.php │ │ │ │ ├── table.blade.php │ │ │ │ ├── footer.blade.php │ │ │ │ ├── promotion.blade.php │ │ │ │ ├── subcopy.blade.php │ │ │ │ ├── button.blade.php │ │ │ │ ├── header.blade.php │ │ │ │ ├── promotion │ │ │ │ │ └── button.blade.php │ │ │ │ ├── layout.blade.php │ │ │ │ └── message.blade.php │ │ │ └── html │ │ │ │ ├── table.blade.php │ │ │ │ ├── header.blade.php │ │ │ │ ├── subcopy.blade.php │ │ │ │ ├── promotion.blade.php │ │ │ │ ├── footer.blade.php │ │ │ │ ├── panel.blade.php │ │ │ │ ├── promotion │ │ │ │ └── button.blade.php │ │ │ │ ├── message.blade.php │ │ │ │ ├── button.blade.php │ │ │ │ ├── layout.blade.php │ │ │ │ └── themes │ │ │ │ └── default.css │ │ ├── .DS_Store │ │ ├── pagination │ │ │ ├── simple-default.blade.php │ │ │ ├── simple-bootstrap-4.blade.php │ │ │ ├── default.blade.php │ │ │ └── bootstrap-4.blade.php │ │ └── notifications │ │ │ └── email.blade.php │ ├── .DS_Store │ ├── templates │ │ ├── formulario │ │ │ ├── submit.blade.php │ │ │ ├── password.blade.php │ │ │ ├── select.blade.php │ │ │ └── input.blade.php │ │ ├── master.blade.php │ │ └── menu-lateral.blade.php │ ├── user │ │ ├── dashboard.blade.php │ │ ├── edit.blade.php │ │ ├── form-fields.blade.php │ │ ├── index.blade.php │ │ ├── list.blade.php │ │ └── login.blade.php │ ├── instituitions │ │ ├── show.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── product │ │ │ └── index.blade.php │ ├── moviment │ │ ├── index.blade.php │ │ ├── all.blade.php │ │ ├── getback.blade.php │ │ └── application.blade.php │ ├── groups │ │ ├── edit.blade.php │ │ ├── show.blade.php │ │ ├── index.blade.php │ │ └── list.blade.php │ └── welcome.blade.php ├── .DS_Store ├── assets │ ├── sass │ │ ├── app.scss │ │ └── _variables.scss │ └── js │ │ ├── app.js │ │ ├── components │ │ └── Example.vue │ │ └── bootstrap.js └── lang │ └── en │ ├── pagination.php │ ├── auth.php │ ├── passwords.php │ └── validation.php ├── .gitattributes ├── .DS_Store ├── .gitignore ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── CreatesApplication.php └── Feature │ └── ExampleTest.php ├── app ├── Repositories │ ├── UserRepository.php │ ├── GroupRepository.php │ ├── ProductRepository.php │ ├── MovimentRepository.php │ ├── InstituitionRepository.php │ ├── GroupRepositoryEloquent.php │ ├── ProductRepositoryEloquent.php │ ├── MovimentRepositoryEloquent.php │ ├── UserRepositoryEloquent.php │ └── InstituitionRepositoryEloquent.php ├── Validators │ ├── ProductValidator.php │ ├── MovimentValidator.php │ ├── InstituitionValidator.php │ ├── UserValidator.php │ └── GroupValidator.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── TrimStrings.php │ │ └── RedirectIfAuthenticated.php │ ├── Requests │ │ ├── GroupCreateRequest.php │ │ ├── GroupUpdateRequest.php │ │ ├── UserCreateRequest.php │ │ ├── UserUpdateRequest.php │ │ ├── ProductCreateRequest.php │ │ ├── ProductUpdateRequest.php │ │ ├── MovimentCreateRequest.php │ │ ├── MovimentUpdateRequest.php │ │ ├── InstituitionCreateRequest.php │ │ └── InstituitionUpdateRequest.php │ ├── Controllers │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── RegisterController.php │ │ ├── Controller.php │ │ ├── DashboardController.php │ │ ├── MovimentsController.php │ │ ├── UsersController.php │ │ ├── InstituitionsController.php │ │ ├── GroupsController.php │ │ └── ProductsController.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ ├── RepositoryServiceProvider.php │ └── RouteServiceProvider.php ├── Presenters │ ├── UserPresenter.php │ ├── GroupPresenter.php │ ├── ProductPresenter.php │ ├── MovimentPresenter.php │ └── InstituitionPresenter.php ├── Entities │ ├── Instituition.php │ ├── UserGroup.php │ ├── UserSocial.php │ ├── Product.php │ ├── Moviment.php │ ├── Group.php │ └── User.php ├── Transformers │ ├── UserTransformer.php │ ├── GroupTransformer.php │ ├── ProductTransformer.php │ ├── MovimentTransformer.php │ └── InstituitionTransformer.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php └── Services │ ├── InstituitionService.php │ ├── UserService.php │ └── GroupService.php ├── routes ├── channels.php ├── api.php ├── console.php └── web.php ├── webpack.mix.js ├── .env.example ├── server.php ├── package.json ├── config ├── services.php ├── view.php ├── broadcasting.php ├── filesystems.php ├── queue.php ├── cache.php ├── auth.php ├── database.php ├── mail.php └── session.php ├── phpunit.xml ├── composer.json ├── artisan └── readme.md /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/panel.blade.php: -------------------------------------------------------------------------------- 1 | {{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/table.blade.php: -------------------------------------------------------------------------------- 1 | {{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/footer.blade.php: -------------------------------------------------------------------------------- 1 | {{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/promotion.blade.php: -------------------------------------------------------------------------------- 1 | {{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/subcopy.blade.php: -------------------------------------------------------------------------------- 1 | {{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/button.blade.php: -------------------------------------------------------------------------------- 1 | {{ $slot }}: {{ $url }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/header.blade.php: -------------------------------------------------------------------------------- 1 | [{{ $slot }}]({{ $url }}) 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/promotion/button.blade.php: -------------------------------------------------------------------------------- 1 | [{{ $slot }}]({{ $url }}) 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/.DS_Store -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/public/.DS_Store -------------------------------------------------------------------------------- /resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/resources/.DS_Store -------------------------------------------------------------------------------- /public/assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/public/assets/.DS_Store -------------------------------------------------------------------------------- /resources/views/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/resources/views/.DS_Store -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/table.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ Illuminate\Mail\Markdown::parse($slot) }} 3 |
4 | -------------------------------------------------------------------------------- /resources/views/templates/formulario/submit.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/vendor/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/resources/views/vendor/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/storage 3 | /public/hot 4 | /storage/*.key 5 | /vendor 6 | /.idea 7 | Homestead.json 8 | Homestead.yaml 9 | .env 10 | -------------------------------------------------------------------------------- /public/assets/images/login-background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aquinopro/projeto-curso-laravel-investimento/HEAD/public/assets/images/login-background.jpg -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/header.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ $slot }} 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/views/templates/formulario/password.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/templates/formulario/select.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ Illuminate\Mail\Markdown::parse($slot) }} 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | 2 | // Fonts 3 | @import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600); 4 | 5 | // Variables 6 | @import "variables"; 7 | 8 | // Bootstrap 9 | @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 10 | -------------------------------------------------------------------------------- /resources/views/instituitions/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('conteudo-view') 4 | 5 |
6 |

{{ $instituition->name }}

7 |
8 | 9 | @include('groups.list', ['group_list' => $instituition->groups]) 10 | 11 | @endsection -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/promotion.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 |
4 | {{ Illuminate\Mail\Markdown::parse($slot) }} 5 |
8 | -------------------------------------------------------------------------------- /resources/views/templates/formulario/input.blade.php: -------------------------------------------------------------------------------- 1 | @php 2 | $attributes['placeholder'] = $attributes['placeholder'] ?? $label; 3 | @endphp 4 | -------------------------------------------------------------------------------- /app/Repositories/UserRepository.php: -------------------------------------------------------------------------------- 1 | [], 13 | ValidatorInterface::RULE_UPDATE => [], 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /app/Validators/MovimentValidator.php: -------------------------------------------------------------------------------- 1 | [], 13 | ValidatorInterface::RULE_UPDATE => [], 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/footer.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'name' => 'required', 14 | ], 15 | ValidatorInterface::RULE_UPDATE => [], 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 |
7 | {{ Illuminate\Mail\Markdown::parse($slot) }} 8 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/promotion/button.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 |
4 | 5 | 6 | 9 | 10 |
7 | {{ $slot }} 8 |
11 |
14 | -------------------------------------------------------------------------------- /app/Validators/UserValidator.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'cpf' => 'required', 14 | 'name' => 'required', 15 | 'phone' => 'required', 16 | 'email' => 'required|unique:users,email', 17 | ], 18 | ValidatorInterface::RULE_UPDATE => [], 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /resources/views/user/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('css-view') 4 | @endsection 5 | 6 | @section('js-view') 7 | @endsection 8 | 9 | @section('conteudo-view') 10 | @if(session('success')) 11 |

{{ session('success')['messages'] }}

12 | @endif 13 | 14 | {!! Form::model($user, ['route' => ['user.update', $user->id], 'method' => 'put', 'class' => 'form-padrao']) !!} 15 | @include('user.form-fields') 16 | @include('templates.formulario.submit', ['input' => 'Atualizar']) 17 | {!! Form::close() !!} 18 | @endsection -------------------------------------------------------------------------------- /app/Presenters/UserPresenter.php: -------------------------------------------------------------------------------- 1 | get('/'); 20 | 21 | $response->assertStatus(200); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /resources/views/user/form-fields.blade.php: -------------------------------------------------------------------------------- 1 | @include('templates.formulario.input', ['label' => 'CPF', 'input' => 'cpf', 'attributes' => ['placeholder' => 'CPF']]) 2 | @include('templates.formulario.input', ['input' => 'name', 'attributes' => ['placeholder' => 'Nome']]) 3 | @include('templates.formulario.input', ['input' => 'phone', 'attributes' => ['placeholder' => 'Telefone']]) 4 | @include('templates.formulario.input', ['input' => 'email', 'attributes' => ['placeholder' => 'E-mail']]) 5 | @include('templates.formulario.password', ['input' => 'password', 'attributes' => ['placeholder' => 'Senha']]) -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /resources/views/user/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('css-view') 4 | @endsection 5 | 6 | @section('js-view') 7 | @endsection 8 | 9 | @section('conteudo-view') 10 | @if(session('success')) 11 |

{{ session('success')['messages'] }}

12 | @endif 13 | 14 | {!! Form::open(['route' => 'user.store', 'method' => 'post', 'class' => 'form-padrao']) !!} 15 | @include('user.form-fields') 16 | @include('templates.formulario.submit', ['input' => 'Cadastrar']) 17 | {!! Form::close() !!} 18 | 19 | @include('user.list', ['user_list' => $users]) 20 | @endsection -------------------------------------------------------------------------------- /app/Presenters/InstituitionPresenter.php: -------------------------------------------------------------------------------- 1 | {{ session('success')['messages'] }} 7 | @endif 8 | 9 | {!! Form::model($instituition, ['route' => ['instituition.update', $instituition->id], 'method' => 'put', 'class' => 'form-padrao']) !!} 10 | @include('templates.formulario.input', ['label' => 'Nome', 'input' => 'name', 'attributes' => ['placeholder' => 'Nome']]) 11 | @include('templates.formulario.submit', ['input' => 'Atualizar']) 12 | {!! Form::close() !!} 13 | 14 | @endsection -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 17 | return $request->user(); 18 | }); 19 | -------------------------------------------------------------------------------- /app/Entities/Instituition.php: -------------------------------------------------------------------------------- 1 | hasMany(Group::class); 20 | } 21 | 22 | public function products() 23 | { 24 | return $this->hasMany(Product::class); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /resources/views/templates/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ivestindo 6 | 7 | 8 | 9 | @yield('css-view') 10 | 11 | 12 | @include('templates.menu-lateral') 13 | 14 |
15 | @yield('conteudo-view') 16 |
17 | 18 | @yield('js-view') 19 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const { mix } = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/assets/js/app.js', 'public/js') 15 | .sass('resources/assets/sass/app.scss', 'public/css'); 16 | -------------------------------------------------------------------------------- /app/Validators/GroupValidator.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'name' => 'required', 14 | 'user_id' => 'required|exists:users,id', 15 | 'instituition_id' => 'required|exists:instituitions,id', 16 | ], 17 | ValidatorInterface::RULE_UPDATE => [ 18 | 'name' => 'required', 19 | ], 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | '11122233366', 17 | 'name' => 'João', 18 | 'phone' => '3599999999', 19 | 'birth' => '1980-10-01', 20 | 'gender' => 'M', 21 | 'email' => 'joaozinhoo@sistema.com', 22 | 'password' => env('PASSWORD_HASH') ? bcrypt('123456') : '123456', 23 | ]); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /app/Http/Requests/GroupCreateRequest.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /app/Http/Requests/ProductCreateRequest.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Entities/UserGroup.php: -------------------------------------------------------------------------------- 1 | {{ session('success')['messages'] }} 6 | @endif 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @foreach($product_list as $product) 19 | 20 | 21 | 22 | 23 | 24 | @endforeach 25 | 26 |
ProdutoNome da InstituiçãoValor investido
{{ $product->name }}{{ $product->instituition->name }}{{ $product->valueFromUser(Auth::user()) }}
27 | @endsection -------------------------------------------------------------------------------- /resources/assets/js/components/Example.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/simple-default.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 17 | @endif 18 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2017_11_13_005714_create_instituitions_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::drop('instituitions'); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any events for your application. 23 | * 24 | * @return void 25 | */ 26 | public function boot() 27 | { 28 | parent::boot(); 29 | 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Transformers/UserTransformer.php: -------------------------------------------------------------------------------- 1 | (int) $model->id, 25 | 26 | /* place your other model properties here */ 27 | 28 | 'created_at' => $model->created_at, 29 | 'updated_at' => $model->updated_at 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Entities/UserSocial.php: -------------------------------------------------------------------------------- 1 | (int) $model->id, 25 | 26 | /* place your other model properties here */ 27 | 28 | 'created_at' => $model->created_at, 29 | 'updated_at' => $model->updated_at 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/views/groups/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('conteudo-view') 4 | {!! Form::model($group, ['route' => ['group.update', $group->id], 'method' => 'put', 'class' => 'form-padrao']) !!} 5 | @include('templates.formulario.input', ['label' => "Nome do Grupo", 'input' => 'name', 'attributes' => ['placeholder' => "Nome do Grupo"]]) 6 | @include('templates.formulario.select', ['label' => "User", 'select' => 'user_id', 'data' => $user_list, 'attributes' => ['placeholder' => "User"]]) 7 | @include('templates.formulario.select', ['label' => "Instituição", 'select' => 'instituition_id', 'data' => $instituition_list, 'attributes' => ['placeholder' => "Instituição"]]) 8 | @include('templates.formulario.submit', ['input' => 'Atualizar']) 9 | {!! Form::close() !!} 10 | @endsection -------------------------------------------------------------------------------- /resources/views/groups/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('conteudo-view') 4 | 5 |
6 |

Nome do grupo: {{ $group->name }}

7 |

Instituição: {{ $group->instituition->name }}

8 |

Responsável: {{ $group->owner->name }}

9 |
10 | 11 | {!! Form::open(['route' => ['group.user.store', $group->id], 'method' => 'post', 'class' => 'form-padrao']) !!} 12 | @include('templates.formulario.select', ['label' => "Usuário", 13 | 'select' => 'user_id', 14 | 'data' => $user_list, 15 | 'attributes' => ['placeholder' => "Usuário"] 16 | ]) 17 | @include('templates.formulario.submit', ['input' => 'Relacionar ao Grupo: ' . $group->name ]) 18 | {!! Form::close() !!} 19 | 20 | @include('user.list', ['user_list' => $group->users]) 21 | 22 | @endsection -------------------------------------------------------------------------------- /resources/views/vendor/mail/markdown/message.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::layout') 2 | {{-- Header --}} 3 | @slot('header') 4 | @component('mail::header', ['url' => config('app.url')]) 5 | {{ config('app.name') }} 6 | @endcomponent 7 | @endslot 8 | 9 | {{-- Body --}} 10 | {{ $slot }} 11 | 12 | {{-- Subcopy --}} 13 | @if (isset($subcopy)) 14 | @slot('subcopy') 15 | @component('mail::subcopy') 16 | {{ $subcopy }} 17 | @endcomponent 18 | @endslot 19 | @endif 20 | 21 | {{-- Footer --}} 22 | @slot('footer') 23 | @component('mail::footer') 24 | © {{ date('Y') }} {{ config('app.name') }}. All rights reserved. 25 | @endcomponent 26 | @endslot 27 | @endcomponent 28 | -------------------------------------------------------------------------------- /app/Transformers/ProductTransformer.php: -------------------------------------------------------------------------------- 1 | (int) $model->id, 25 | 26 | /* place your other model properties here */ 27 | 28 | 'created_at' => $model->created_at, 29 | 'updated_at' => $model->updated_at 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/message.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::layout') 2 | {{-- Header --}} 3 | @slot('header') 4 | @component('mail::header', ['url' => config('app.url')]) 5 | {{ config('app.name') }} 6 | @endcomponent 7 | @endslot 8 | 9 | {{-- Body --}} 10 | {{ $slot }} 11 | 12 | {{-- Subcopy --}} 13 | @if (isset($subcopy)) 14 | @slot('subcopy') 15 | @component('mail::subcopy') 16 | {{ $subcopy }} 17 | @endcomponent 18 | @endslot 19 | @endif 20 | 21 | {{-- Footer --}} 22 | @slot('footer') 23 | @component('mail::footer') 24 | © {{ date('Y') }} {{ config('app.name') }}. All rights reserved. 25 | @endcomponent 26 | @endslot 27 | @endcomponent 28 | -------------------------------------------------------------------------------- /app/Transformers/MovimentTransformer.php: -------------------------------------------------------------------------------- 1 | (int) $model->id, 25 | 26 | /* place your other model properties here */ 27 | 28 | 'created_at' => $model->created_at, 29 | 'updated_at' => $model->updated_at 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/views/moviment/all.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | @section('conteudo-view') 3 | 4 | @if(session('success')) 5 |

{{ session('success')['messages'] }}

6 | @endif 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @foreach($moviment_list as $moviment) 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | @endforeach 29 | 30 |
DataTipoProdutoGrupoValor
{{ $moviment->created_at->format("d/m/Y H:i") }}{{ $moviment->type == 1 ? "Aplicação" : "Resgate" }}{{ $moviment->product->name }}{{ $moviment->group->name }}{{ $moviment->value }}
31 | @endsection -------------------------------------------------------------------------------- /resources/views/vendor/pagination/simple-bootstrap-4.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 17 | @endif 18 | -------------------------------------------------------------------------------- /app/Transformers/InstituitionTransformer.php: -------------------------------------------------------------------------------- 1 | (int) $model->id, 25 | 26 | /* place your other model properties here */ 27 | 28 | 'created_at' => $model->created_at, 29 | 'updated_at' => $model->updated_at 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/views/groups/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('conteudo-view') 4 | 5 | {!! Form::open(['route' => 'group.store', 'method' => 'post', 'class' => 'form-padrao']) !!} 6 | @include('templates.formulario.input', ['label' => "Nome do Grupo", 'input' => 'name', 'attributes' => ['placeholder' => "Nome do Grupo"]]) 7 | @include('templates.formulario.select', ['label' => "User", 'select' => 'user_id', 'data' => $user_list, 'attributes' => ['placeholder' => "User"]]) 8 | @include('templates.formulario.select', ['label' => "Instituição", 'select' => 'instituition_id', 'data' => $instituition_list, 'attributes' => ['placeholder' => "Instituição"]]) 9 | @include('templates.formulario.submit', ['input' => 'Cadastrar']) 10 | {!! Form::close() !!} 11 | 12 | @include('groups.list', ['group_list' => $groups]) 13 | @endsection -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/button.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 |
4 | 5 | 6 | 15 | 16 |
7 | 8 | 9 | 12 | 13 |
10 | {{ $slot }} 11 |
14 |
17 |
20 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(App\User::class, function (Faker\Generator $faker) { 16 | static $password; 17 | 18 | return [ 19 | 'name' => $faker->name, 20 | 'email' => $faker->unique()->safeEmail, 21 | 'password' => $password ?: $password = bcrypt('secret'), 22 | 'remember_token' => str_random(10), 23 | ]; 24 | }); 25 | -------------------------------------------------------------------------------- /resources/views/moviment/getback.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | 4 | @section('conteudo-view') 5 | @if(session('success')) 6 |

{{ session('success')['messages'] }}

7 | @endif 8 | 9 | {!! Form::open(['route' => 'moviment.getback.store', 'method' => 'post', 'class' => 'form-padrao']) !!} 10 | @include('templates.formulario.select', ['label' => "Grupo", 'select' => 'group_id', 'data' => $group_list ?? [], 'attributes' => ['placeholder' => "Grupo"]]) 11 | @include('templates.formulario.select', ['label' => "Produto", 'select' => 'product_id', 'data' => $product_list ?? [], 'attributes' => ['placeholder' => "Produto"]]) 12 | @include('templates.formulario.input', ['label' => 'Valor', 'input' => 'value', 'attributes' => ['placeholder' => 'Valor']]) 13 | @include('templates.formulario.submit', ['input' => 'Cadastrar']) 14 | {!! Form::close() !!} 15 | 16 | @endsection -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token')->index(); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/views/moviment/application.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | 4 | @section('conteudo-view') 5 | @if(session('success')) 6 |

{{ session('success')['messages'] }}

7 | @endif 8 | 9 | {!! Form::open(['route' => 'moviment.application.store', 'method' => 'post', 'class' => 'form-padrao']) !!} 10 | @include('templates.formulario.select', ['label' => "Grupo", 'select' => 'group_id', 'data' => $group_list ?? [], 'attributes' => ['placeholder' => "Grupo"]]) 11 | @include('templates.formulario.select', ['label' => "Produto", 'select' => 'product_id', 'data' => $product_list ?? [], 'attributes' => ['placeholder' => "Produto"]]) 12 | @include('templates.formulario.input', ['label' => 'Valor', 'input' => 'value', 'attributes' => ['placeholder' => 'Valor']]) 13 | @include('templates.formulario.submit', ['input' => 'Cadastrar']) 14 | {!! Form::close() !!} 15 | 16 | @endsection -------------------------------------------------------------------------------- /app/Entities/Product.php: -------------------------------------------------------------------------------- 1 | belongsTo(Instituition::class); 18 | } 19 | 20 | 21 | public function valueFromUser(User $user) 22 | { 23 | $inflows = $this->moviments()->product($this)->applications()->sum('value'); 24 | $outflows = $this->moviments()->product($this)->outflows()->sum('value'); 25 | return $inflows - $outflows; 26 | } 27 | 28 | public function moviments() 29 | { 30 | return $this->hasMany(Moviment::class); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /resources/views/groups/list.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | @foreach($group_list as $group) 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | @endforeach 28 | 29 |
#Nome do GrupoInstituiçãoNome do ResposávelOpções
{{ $group->id }}{{ $group->name }}R$ {{ number_format($group->total_value, 2, ',', '.') }}{{ $group->instituition->name }}{{ $group->owner->name }} 20 | {!! Form::open(['route' => ['group.destroy', $group->id], 'method' => 'DELETE']) !!} 21 | {!! Form::submit('Remover') !!} 22 | {!! Form::close() !!} 23 | Detalhes 24 | Editar 25 |
-------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the Closure based commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | require base_path('routes/console.php'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2017_11_19_023804_create_groups_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->unsignedInteger('user_id'); 20 | $table->unsignedInteger('instituition_id'); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | 24 | $table->foreign('user_id')->references('id')->on('users'); 25 | $table->foreign('instituition_id')->references('id')->on('instituitions'); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::drop('groups'); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /resources/views/user/list.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | @foreach($user_list as $user) 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | @endforeach 34 | 35 |
#CPFNomeTelefoneNascimentoE-mailStatusPermissãoMenu
{{ $user->id }}{{ $user->formatted_cpf }}{{ $user->name }}{{ $user->formatted_phone }}{{ $user->formatted_birth }}{{ $user->email }}{{ $user->status }}{{ $user->permission }} 27 | {!! Form::open(['route' => ['user.destroy', $user->id], 'method' => 'DELETE']) !!} 28 | {!! Form::submit('Remover') !!} 29 | {!! Form::close() !!} 30 | Editar 31 |
-------------------------------------------------------------------------------- /app/Entities/Moviment.php: -------------------------------------------------------------------------------- 1 | where('product_id', $product->id); 18 | } 19 | 20 | public function scopeApplications($query){ 21 | return $query->where('type', 1); 22 | } 23 | 24 | public function scopeOutflows($query){ 25 | return $query->where('type', 2); 26 | } 27 | 28 | 29 | public function user(){ 30 | return $this->belongsTo(User::class); 31 | } 32 | 33 | public function group(){ 34 | return $this->belongsTo(Group::class); 35 | } 36 | 37 | public function product(){ 38 | return $this->belongsTo(Product::class); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | $variavel 21 | ]); 22 | } 23 | 24 | public function cadastar() 25 | { 26 | echo "Tela de cadastro"; 27 | } 28 | 29 | 30 | /** 31 | * method to user login VIEW 32 | * ======================================================================== 33 | */ 34 | public function fazerLogin() 35 | { 36 | return view('user.login'); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /resources/assets/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | 2 | // Body 3 | $body-bg: #f5f8fa; 4 | 5 | // Borders 6 | $laravel-border-color: darken($body-bg, 10%); 7 | $list-group-border: $laravel-border-color; 8 | $navbar-default-border: $laravel-border-color; 9 | $panel-default-border: $laravel-border-color; 10 | $panel-inner-border: $laravel-border-color; 11 | 12 | // Brands 13 | $brand-primary: #3097D1; 14 | $brand-info: #8eb4cb; 15 | $brand-success: #2ab27b; 16 | $brand-warning: #cbb956; 17 | $brand-danger: #bf5329; 18 | 19 | // Typography 20 | $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/"; 21 | $font-family-sans-serif: "Raleway", sans-serif; 22 | $font-size-base: 14px; 23 | $line-height-base: 1.6; 24 | $text-color: #636b6f; 25 | 26 | // Navbar 27 | $navbar-default-bg: #fff; 28 | 29 | // Buttons 30 | $btn-default-color: $text-color; 31 | 32 | // Inputs 33 | $input-border: lighten($text-color, 40%); 34 | $input-border-focus: lighten($brand-primary, 25%); 35 | $input-color-placeholder: lighten($text-color, 30%); 36 | 37 | // Panels 38 | $panel-default-heading-bg: #fff; 39 | -------------------------------------------------------------------------------- /app/Entities/Group.php: -------------------------------------------------------------------------------- 1 | moviments()->applications()->sum('value') - $this->moviments()->outflows()->sum('value'); 18 | } 19 | 20 | public function owner() 21 | { 22 | return $this->belongsTo(User::class, 'user_id'); 23 | } 24 | 25 | public function users() 26 | { 27 | // RELACIONAMENTO N:N 28 | return $this->belongsToMany(User::class, 'user_groups'); 29 | } 30 | 31 | 32 | public function instituition() 33 | { 34 | return $this->belongsTo(Instituition::class); 35 | } 36 | 37 | public function moviments() 38 | { 39 | return $this->hasMany(Moviment::class); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /database/migrations/2017_12_27_011812_create_products_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->unsignedInteger('instituition_id'); 19 | $table->string('name', 45); 20 | $table->text('description'); 21 | $table->text('index'); 22 | $table->decimal('interest_rate'); 23 | 24 | $table->timestampsTz(); 25 | $table->softDeletes(); 26 | 27 | $table->foreign('instituition_id')->references('id')->on('instituitions'); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | * 34 | * @return void 35 | */ 36 | public function down() 37 | { 38 | Schema::dropIfExists('products'); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/Repositories/GroupRepositoryEloquent.php: -------------------------------------------------------------------------------- 1 | pushCriteria(app(RequestCriteria::class)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 5 | "watch": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "hot": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 7 | "production": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 8 | }, 9 | "devDependencies": { 10 | "axios": "^0.15.2", 11 | "bootstrap-sass": "^3.3.7", 12 | "jquery": "^3.1.0", 13 | "laravel-mix": "^0.6.0", 14 | "lodash": "^4.16.2", 15 | "vue": "^2.0.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Repositories/ProductRepositoryEloquent.php: -------------------------------------------------------------------------------- 1 | pushCriteria(app(RequestCriteria::class)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Repositories/MovimentRepositoryEloquent.php: -------------------------------------------------------------------------------- 1 | pushCriteria(app(RequestCriteria::class)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /resources/views/templates/menu-lateral.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/user/login.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Login | Investindo 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 |

Investindo

15 |

O nosso gerenciador de investimento

16 | 17 | {!! Form::open(['route' => 'user.login', 'method' => 'post']) !!} 18 | 19 |

Acesse o sistema

20 | 21 | 24 | 25 | 28 | 29 | {!! Form::submit('Entrar') !!} 30 | 31 | {!! Form::close() !!} 32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest', ['except' => 'logout']); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => 'us-east-1', 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /database/migrations/2017_11_28_015355_create_user_groups_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->unsignedInteger('user_id'); 19 | $table->unsignedInteger('group_id'); 20 | $table->string('permision')->default('default'); 21 | $table->timestampsTz(); 22 | $table->softDeletes(); 23 | 24 | $table->foreign('user_id')->references('id')->on('users'); 25 | $table->foreign('group_id')->references('id')->on('groups'); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('user_groups'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Feature 14 | 15 | 16 | 17 | ./tests/Unit 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/Providers/RepositoryServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind(\App\Repositories\UserRepository::class, \App\Repositories\UserRepositoryEloquent::class); 27 | $this->app->bind(\App\Repositories\InstituitionRepository::class, \App\Repositories\InstituitionRepositoryEloquent::class); 28 | $this->app->bind(\App\Repositories\GroupRepository::class, \App\Repositories\GroupRepositoryEloquent::class); 29 | $this->app->bind(\App\Repositories\ProductRepository::class, \App\Repositories\ProductRepositoryEloquent::class); 30 | $this->app->bind(\App\Repositories\MovimentRepository::class, \App\Repositories\MovimentRepositoryEloquent::class); 31 | //:end-bindings: 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2018_01_24_164217_create_moviments_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->unsignedInteger('user_id'); 19 | $table->unsignedInteger('group_id'); 20 | $table->unsignedInteger('product_id'); 21 | $table->decimal('value'); 22 | $table->integer('type'); 23 | 24 | $table->timestampsTz(); 25 | $table->softDeletes(); 26 | 27 | $table->foreign('user_id')->references('id')->on('users'); 28 | $table->foreign('group_id')->references('id')->on('groups'); 29 | $table->foreign('product_id')->references('id')->on('products'); 30 | }); 31 | } 32 | 33 | /** 34 | * Reverse the migrations. 35 | * 36 | * @return void 37 | */ 38 | public function down() 39 | { 40 | Schema::drop('moviments'); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/Repositories/UserRepositoryEloquent.php: -------------------------------------------------------------------------------- 1 | model->pluck($descricao, $chave)->all(); 20 | } 21 | 22 | /** 23 | * Specify Model class name 24 | * 25 | * @return string 26 | */ 27 | public function model() 28 | { 29 | return User::class; 30 | } 31 | 32 | /** 33 | * Specify Validator class name 34 | * 35 | * @return mixed 36 | */ 37 | public function validator() 38 | { 39 | 40 | return UserValidator::class; 41 | } 42 | 43 | 44 | /** 45 | * Boot up the repository, pushing criteria 46 | */ 47 | public function boot() 48 | { 49 | $this->pushCriteria(app(RequestCriteria::class)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/views/instituitions/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | 4 | @section('conteudo-view') 5 | 6 | @if(session('success')) 7 |

{{ session('success')['messages'] }}

8 | @endif 9 | 10 | {!! Form::open(['route' => 'instituition.store', 'method' => 'post', 'class' => 'form-padrao']) !!} 11 | @include('templates.formulario.input', ['label' => 'Nome', 'input' => 'name', 'attributes' => ['placeholder' => 'Nome']]) 12 | @include('templates.formulario.submit', ['input' => 'Cadastrar']) 13 | {!! Form::close() !!} 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach($instituitions as $inst) 25 | 26 | 27 | 28 | 36 | 37 | @endforeach 38 | 39 |
#Nome da InstituiçãoOpções
{{ $inst->id }}{{ $inst->name }} 29 | {!! Form::open(['route' => ['instituition.destroy', $inst->id], 'method' => 'delete']) !!} 30 | {!! Form::submit("Remover") !!} 31 | {!! Form::close() !!} 32 | Detalhes 33 | Editar 34 | Produtos 35 |
40 | @endsection -------------------------------------------------------------------------------- /app/Repositories/InstituitionRepositoryEloquent.php: -------------------------------------------------------------------------------- 1 | model->pluck($descricao, $chave)->all(); 21 | } 22 | 23 | 24 | /** 25 | * Specify Model class name 26 | * 27 | * @return string 28 | */ 29 | public function model() 30 | { 31 | return Instituition::class; 32 | } 33 | 34 | /** 35 | * Specify Validator class name 36 | * 37 | * @return mixed 38 | */ 39 | public function validator() 40 | { 41 | 42 | return InstituitionValidator::class; 43 | } 44 | 45 | 46 | /** 47 | * Boot up the repository, pushing criteria 48 | */ 49 | public function boot() 50 | { 51 | $this->pushCriteria(app(RequestCriteria::class)); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /resources/views/vendor/notifications/email.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | {{-- Greeting --}} 3 | @if (! empty($greeting)) 4 | # {{ $greeting }} 5 | @else 6 | @if ($level == 'error') 7 | # Whoops! 8 | @else 9 | # Hello! 10 | @endif 11 | @endif 12 | 13 | {{-- Intro Lines --}} 14 | @foreach ($introLines as $line) 15 | {{ $line }} 16 | 17 | @endforeach 18 | 19 | {{-- Action Button --}} 20 | @if (isset($actionText)) 21 | 33 | @component('mail::button', ['url' => $actionUrl, 'color' => $color]) 34 | {{ $actionText }} 35 | @endcomponent 36 | @endif 37 | 38 | {{-- Outro Lines --}} 39 | @foreach ($outroLines as $line) 40 | {{ $line }} 41 | 42 | @endforeach 43 | 44 | 45 | @if (! empty($salutation)) 46 | {{ $salutation }} 47 | @else 48 | Regards,
{{ config('app.name') }} 49 | @endif 50 | 51 | 52 | @if (isset($actionText)) 53 | @component('mail::subcopy') 54 | If you’re having trouble clicking the "{{ $actionText }}" button, copy and paste the URL below 55 | into your web browser: [{{ $actionUrl }}]({{ $actionUrl }}) 56 | @endcomponent 57 | @endif 58 | @endcomponent 59 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/default.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 36 | @endif 37 | -------------------------------------------------------------------------------- /database/migrations/2017_03_22_231714_create_user_socials_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | 20 | $table->integer('user_id')->unsined(); 21 | $table->string('social_network'); 22 | $table->string('social_id'); 23 | $table->string('social_email'); 24 | $table->string('social_avatar'); 25 | 26 | $table->timestamps(); 27 | 28 | $table->foreign('user_id')->references('id')->on('users'); 29 | $table->foreign('social_email')->references('email')->on('users'); 30 | 31 | }); 32 | */ 33 | } 34 | 35 | /** 36 | * Reverse the migrations. 37 | * 38 | * @return void 39 | */ 40 | public function down() 41 | { 42 | /* 43 | Schema::table('user_socials', function (Blueprint $table){ 44 | $table->dropForeign('user_socials_user_id_foreign'); 45 | $table->dropForeign('user_socials_social_email_foreign'); 46 | }); 47 | 48 | Schema::dropIfExists('user_socials'); 49 | */ 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /database/migrations/2017_03_15_002140_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | 19 | //people data 20 | $table->char('cpf', 11)->unique()->nullalbe(); 21 | $table->string('name', 50); 22 | $table->char('phone', 11); 23 | $table->date('birth')->nullalbe(); 24 | $table->char('gender', 1)->nullable(); 25 | $table->text('notes')->nullable(); 26 | 27 | //auth data 28 | $table->string('email', 80)->unique(); 29 | $table->string('password', 254)->nullable(); 30 | 31 | //Permission 32 | $table->string('status')->default('active'); 33 | $table->string('permission')->default('app.user'); 34 | 35 | $table->rememberToken(); 36 | $table->timestamps(); 37 | $table->softDeletes(); 38 | }); 39 | } 40 | 41 | /** 42 | * Reverse the migrations. 43 | * 44 | * @return void 45 | */ 46 | public function down() 47 | { 48 | Schema::table('users', function(Blueprint $table) { 49 | }); 50 | Schema::drop('users'); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "require": { 8 | "php": ">=5.6.4", 9 | "laravel/framework": "5.4.*", 10 | "laravel/tinker": "~1.0", 11 | "laravelcollective/html": "^5.4", 12 | "prettus/l5-repository": "^2.6" 13 | }, 14 | "require-dev": { 15 | "fzaninotto/faker": "~1.4", 16 | "mockery/mockery": "0.9.*", 17 | "phpunit/phpunit": "~5.7" 18 | }, 19 | "autoload": { 20 | "classmap": [ 21 | "database" 22 | ], 23 | "psr-4": { 24 | "App\\": "app/" 25 | } 26 | }, 27 | "autoload-dev": { 28 | "psr-4": { 29 | "Tests\\": "tests/" 30 | } 31 | }, 32 | "scripts": { 33 | "post-root-package-install": [ 34 | "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 35 | ], 36 | "post-create-project-cmd": [ 37 | "php artisan key:generate" 38 | ], 39 | "post-install-cmd": [ 40 | "Illuminate\\Foundation\\ComposerScripts::postInstall", 41 | "php artisan optimize" 42 | ], 43 | "post-update-cmd": [ 44 | "Illuminate\\Foundation\\ComposerScripts::postUpdate", 45 | "php artisan optimize" 46 | ] 47 | }, 48 | "config": { 49 | "preferred-install": "dist", 50 | "sort-packages": true 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /resources/assets/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | 2 | window._ = require('lodash'); 3 | 4 | /** 5 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 6 | * for JavaScript based Bootstrap features such as modals and tabs. This 7 | * code may be modified to fit the specific needs of your application. 8 | */ 9 | 10 | window.$ = window.jQuery = require('jquery'); 11 | 12 | require('bootstrap-sass'); 13 | 14 | /** 15 | * Vue is a modern JavaScript library for building interactive web interfaces 16 | * using reactive data binding and reusable components. Vue's API is clean 17 | * and simple, leaving you to focus on building your next great project. 18 | */ 19 | 20 | window.Vue = require('vue'); 21 | 22 | /** 23 | * We'll load the axios HTTP library which allows us to easily issue requests 24 | * to our Laravel back-end. This library automatically handles sending the 25 | * CSRF token as a header based on the value of the "XSRF" token cookie. 26 | */ 27 | 28 | window.axios = require('axios'); 29 | 30 | window.axios.defaults.headers.common = { 31 | 'X-CSRF-TOKEN': window.Laravel.csrfToken, 32 | 'X-Requested-With': 'XMLHttpRequest' 33 | }; 34 | 35 | /** 36 | * Echo exposes an expressive API for subscribing to channels and listening 37 | * for events that are broadcast by Laravel. Echo and event broadcasting 38 | * allows your team to easily build robust real-time web applications. 39 | */ 40 | 41 | // import Echo from "laravel-echo" 42 | 43 | // window.Echo = new Echo({ 44 | // broadcaster: 'pusher', 45 | // key: 'your-pusher-key' 46 | // }); 47 | -------------------------------------------------------------------------------- /app/Http/Controllers/DashboardController.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 20 | $this->validator = $validator; 21 | } 22 | 23 | 24 | public function index() 25 | { 26 | return view('user.dashboard'); 27 | } 28 | 29 | 30 | public function auth(Request $request) 31 | { 32 | $data = [ 33 | 'email' => $request->get('username'), 34 | 'password' => $request->get('password') 35 | ]; 36 | 37 | try 38 | { 39 | if(env('PASSWORD_HASH')) 40 | { 41 | Auth::attempt($data, false); 42 | } 43 | else 44 | { 45 | $user = $this->repository->findWhere(['email' => $request->get('username')])->first(); 46 | 47 | if(!$user) 48 | throw new Exception("O e-mail informado é inválido. PEEEEN!"); 49 | 50 | if($user->password != $request->get('password')) 51 | throw new Exception("A senha informada é inválida. PEEEEN!"); 52 | 53 | Auth::login($user); 54 | } 55 | 56 | return redirect()->route('user.dashboard'); 57 | } 58 | catch (Exception $e) 59 | { 60 | return $e->getMessage(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /resources/views/instituitions/product/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('templates.master') 2 | 3 | @section('conteudo-view') 4 | {!! Form::open(['route' => ['instituition.product.store', $instituition->id], 'method' => 'post', 'class' => 'form-padrao']) !!} 5 | @include('templates.formulario.input', ['label' => 'Nome do Produto', 'input' => 'name']) 6 | @include('templates.formulario.input', ['label' => 'Descrição', 'input' => 'description']) 7 | @include('templates.formulario.input', ['label' => 'Indexador', 'input' => 'index']) 8 | @include('templates.formulario.input', ['label' => 'Taxa de Juros', 'input' => 'interest_rate']) 9 | @include('templates.formulario.submit', ['input' => 'Cadastrar']) 10 | {!! Form::close() !!} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | @forelse($instituition->products as $product) 23 | 24 | 25 | 26 | 27 | 28 | 29 | 35 | 36 | @empty 37 | 38 | 39 | 40 | @endforelse 41 | 42 |
#NomeDescriçãoIndexadorTaxaOpções
{{ $product->id }}{{ $product->name }}{{ $product->description }}{{ $product->index }}{{ $product->interest_rate }} 30 | {!! Form::open(['route' => ['instituition.product.destroy', $instituition->id, $product->id], 'method' => 'DELETE']) !!} 31 | {!! Form::submit('Remover') !!} 32 | {!! Form::close() !!} 33 | Editar 34 |
Nada cadastrado.
43 | @endsection -------------------------------------------------------------------------------- /resources/views/vendor/pagination/bootstrap-4.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 36 | @endif 37 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | // 40 | ], 41 | ], 42 | 43 | 'redis' => [ 44 | 'driver' => 'redis', 45 | 'connection' => 'default', 46 | ], 47 | 48 | 'log' => [ 49 | 'driver' => 'log', 50 | ], 51 | 52 | 'null' => [ 53 | 'driver' => 'null', 54 | ], 55 | 56 | ], 57 | 58 | ]; 59 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 32 | 33 | $status = $kernel->handle( 34 | $input = new Symfony\Component\Console\Input\ArgvInput, 35 | new Symfony\Component\Console\Output\ConsoleOutput 36 | ); 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Shutdown The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once Artisan has finished running. We will fire off the shutdown events 44 | | so that any final work may be done by the application before we shut 45 | | down the process. This is the last thing to happen to the request. 46 | | 47 | */ 48 | 49 | $kernel->terminate($input, $status); 50 | 51 | exit($status); 52 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Entities/User.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Group::class, 'user_groups'); 27 | } 28 | 29 | public function moviments(){ 30 | return $this->hasMany(Moviment::class); 31 | } 32 | 33 | 34 | 35 | public function setPasswordAttribute($value) 36 | { 37 | $this->attributes['password'] = env('PASSWORD_HASH') ? bcrypt($value) : $value; 38 | } 39 | 40 | 41 | public function getFormattedCpfAttribute() 42 | { 43 | $cpf = $this->attributes['cpf']; 44 | return substr($cpf, 0, 3) . '.' . substr($cpf, 3, 3) . '.' . substr($cpf, 7, 3) . '-' . substr($cpf, -2); 45 | } 46 | 47 | public function getFormattedPhoneAttribute() 48 | { 49 | $phone = $this->attributes['phone']; 50 | return "(" . substr($phone, 0, 2) . ") " . substr($phone, 2, 4) . "-" . substr($phone, -4); 51 | } 52 | 53 | public function getFormattedBirthAttribute() 54 | { 55 | $birth = explode('-', $this->attributes['birth']); 56 | 57 | if(count( (array) $birth) != 3) 58 | return ""; 59 | 60 | $birth = $birth[2] . '/' . $birth[1] . '/' . $birth[0]; 61 | return $birth; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | /* 11 | |-------------------------------------------------------------------------- 12 | | Register The Auto Loader 13 | |-------------------------------------------------------------------------- 14 | | 15 | | Composer provides a convenient, automatically generated class loader for 16 | | our application. We just need to utilize it! We'll simply require it 17 | | into the script here so that we don't have to worry about manual 18 | | loading any of our classes later on. It feels nice to relax. 19 | | 20 | */ 21 | 22 | require __DIR__.'/../bootstrap/autoload.php'; 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Turn On The Lights 27 | |-------------------------------------------------------------------------- 28 | | 29 | | We need to illuminate PHP development, so let us turn on the lights. 30 | | This bootstraps the framework and gets it ready for use, then it 31 | | will load up this application so that we can run it and send 32 | | the responses back to the browser and delight our users. 33 | | 34 | */ 35 | 36 | $app = require_once __DIR__.'/../bootstrap/app.php'; 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Run The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once we have the application, we can handle the incoming request 44 | | through the kernel, and send the associated response back to 45 | | the client's browser allowing them to enjoy the creative 46 | | and wonderful application we have prepared for them. 47 | | 48 | */ 49 | 50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 51 | 52 | $response = $kernel->handle( 53 | $request = Illuminate\Http\Request::capture() 54 | ); 55 | 56 | $response->send(); 57 | 58 | $kernel->terminate($request, $response); 59 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/layout.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 25 | 26 | 27 | 28 | 51 | 52 |
29 | 30 | {{ $header or '' }} 31 | 32 | 33 | 34 | 46 | 47 | 48 | {{ $footer or '' }} 49 |
35 | 36 | 37 | 38 | 43 | 44 |
39 | {{ Illuminate\Mail\Markdown::parse($slot) }} 40 | 41 | {{ $subcopy or '' }} 42 |
45 |
50 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 40 | } 41 | 42 | /** 43 | * Get a validator for an incoming registration request. 44 | * 45 | * @param array $data 46 | * @return \Illuminate\Contracts\Validation\Validator 47 | */ 48 | protected function validator(array $data) 49 | { 50 | return Validator::make($data, [ 51 | 'name' => 'required|max:255', 52 | 'email' => 'required|email|max:255|unique:users', 53 | 'password' => 'required|min:6|confirmed', 54 | ]); 55 | } 56 | 57 | /** 58 | * Create a new user instance after a valid registration. 59 | * 60 | * @param array $data 61 | * @return User 62 | */ 63 | protected function create(array $data) 64 | { 65 | return User::create([ 66 | 'name' => $data['name'], 67 | 'email' => $data['email'], 68 | 'password' => bcrypt($data['password']), 69 | ]); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 60 | return response()->json(['error' => 'Unauthenticated.'], 401); 61 | } 62 | 63 | return redirect()->guest('login'); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 30 | \App\Http\Middleware\EncryptCookies::class, 31 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 32 | \Illuminate\Session\Middleware\StartSession::class, 33 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 34 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 35 | \App\Http\Middleware\VerifyCsrfToken::class, 36 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 37 | ], 38 | 39 | 'api' => [ 40 | 'throttle:60,1', 41 | 'bindings', 42 | ], 43 | ]; 44 | 45 | /** 46 | * The application's route middleware. 47 | * 48 | * These middleware may be assigned to groups or used individually. 49 | * 50 | * @var array 51 | */ 52 | protected $routeMiddleware = [ 53 | 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 54 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 55 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 56 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 57 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 58 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 59 | ]; 60 | } 61 | -------------------------------------------------------------------------------- /app/Services/InstituitionService.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 17 | $this->validator = $validator; 18 | } 19 | 20 | public function store(array $data) 21 | { 22 | try 23 | { 24 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE); 25 | $instituition = $this->repository->create($data); 26 | 27 | return [ 28 | 'success' => true, 29 | 'messages' => "Instituição cadasrada", 30 | 'data' => $instituition, 31 | ]; 32 | } 33 | catch(Exception $e) 34 | { 35 | switch(get_class($e)) 36 | { 37 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 38 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 39 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 40 | default : return ['success' => false, 'messages' => get_class($e)]; 41 | } 42 | } 43 | } 44 | 45 | public function update(array $data, $id) 46 | { 47 | try 48 | { 49 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); 50 | $instituition = $this->repository->update($data, $id); 51 | 52 | return [ 53 | 'success' => true, 54 | 'messages' => "Instituição atualizada", 55 | 'data' => $instituition, 56 | ]; 57 | } 58 | catch(Exception $e) 59 | { 60 | switch(get_class($e)) 61 | { 62 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 63 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 64 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 65 | default : return ['success' => false, 'messages' => get_class($e)]; 66 | } 67 | } 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | 'Controller@homepage']); 14 | Route::get('/cadastro', ['uses' => 'Controller@cadastar']); 15 | 16 | 17 | /** 18 | * Routes to user auth 19 | * ======================================================================== 20 | */ 21 | Route::get('/login', ['uses' => 'Controller@fazerLogin']); 22 | Route::post('/login', ['as' => 'user.login', 'uses' => 'DashboardController@auth']); 23 | Route::get('/dashboard', ['as' => 'user.dashboard', 'uses' => 'DashboardController@index']); 24 | 25 | Route::get('user/moviment', ['as' => 'moviment.index', 'uses' => 'MovimentsController@index']); 26 | 27 | Route::get('getback', ['as' => 'moviment.getback', 'uses' => 'MovimentsController@getback']); 28 | Route::post('getback', ['as' => 'moviment.getback.store', 'uses' => 'MovimentsController@storeGetback']); 29 | 30 | Route::get('moviment', ['as' => 'moviment.application', 'uses' => 'MovimentsController@application']); 31 | Route::post('moviment', ['as' => 'moviment.application.store', 'uses' => 'MovimentsController@storeApplication']); 32 | 33 | Route::get('moviment/all',['as' => 'moviment.all', 'uses' => 'MovimentsController@all']); 34 | 35 | Route::resource('user', 'UsersController'); 36 | Route::resource('instituition', 'InstituitionsController'); 37 | Route::resource('group', 'GroupsController'); 38 | Route::resource('instituition.product', 'ProductsController'); 39 | 40 | 41 | #Route::get('group', 'GroupsController@index'); 42 | #Route::post('group', 'GroupsController@store'); 43 | #Route::get('group/{id}', 'GroupsController@show'); 44 | #Route::update('group/{id}', 'GroupsController@update'); 45 | #Route::delete('group/{id}', 'GroupsController@delete'); 46 | 47 | 48 | Route::post('group/{group_id}/user', ['as' => 'group.user.store', 'uses' => 'GroupsController@userStore']); 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | 'local', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => 's3', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_KEY'), 61 | 'secret' => env('AWS_SECRET'), 62 | 'region' => env('AWS_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | ], 65 | 66 | ], 67 | 68 | ]; 69 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => 'your-public-key', 54 | 'secret' => 'your-secret-key', 55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', 56 | 'queue' => 'your-queue-name', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'retry_after' => 90, 65 | ], 66 | 67 | ], 68 | 69 | /* 70 | |-------------------------------------------------------------------------- 71 | | Failed Queue Jobs 72 | |-------------------------------------------------------------------------- 73 | | 74 | | These options configure the behavior of failed queue job logging so you 75 | | can control which database and table are used to store the jobs that 76 | | have failed. You may change them to any database / table you wish. 77 | | 78 | */ 79 | 80 | 'failed' => [ 81 | 'database' => env('DB_CONNECTION', 'mysql'), 82 | 'table' => 'failed_jobs', 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache/data'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 55 | 'sasl' => [ 56 | env('MEMCACHED_USERNAME'), 57 | env('MEMCACHED_PASSWORD'), 58 | ], 59 | 'options' => [ 60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 61 | ], 62 | 'servers' => [ 63 | [ 64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 65 | 'port' => env('MEMCACHED_PORT', 11211), 66 | 'weight' => 100, 67 | ], 68 | ], 69 | ], 70 | 71 | 'redis' => [ 72 | 'driver' => 'redis', 73 | 'connection' => 'default', 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Cache Key Prefix 81 | |-------------------------------------------------------------------------- 82 | | 83 | | When utilizing a RAM based store such as APC or Memcached, there might 84 | | be other applications utilizing the same cache. So, we'll specify a 85 | | value to get prefixed to all our keys so we can avoid collisions. 86 | | 87 | */ 88 | 89 | 'prefix' => 'laravel', 90 | 91 | ]; 92 | -------------------------------------------------------------------------------- /app/Services/UserService.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 20 | $this->validator = $validator; 21 | } 22 | 23 | public function store($data) 24 | { 25 | try 26 | { 27 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE); 28 | $usuario = $this->repository->create($data); 29 | 30 | return [ 31 | 'success' => true, 32 | 'messages' => "Usuário cadasrado", 33 | 'data' => $usuario, 34 | ]; 35 | } 36 | catch(Exception $e) 37 | { 38 | switch(get_class($e)) 39 | { 40 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 41 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 42 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 43 | default : return ['success' => false, 'messages' => get_class($e)]; 44 | } 45 | } 46 | } 47 | 48 | public function update($data, $id) 49 | { 50 | try 51 | { 52 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); 53 | $usuario = $this->repository->update($data, $id); 54 | 55 | return [ 56 | 'success' => true, 57 | 'messages' => "Usuário atualizado", 58 | 'data' => $usuario, 59 | ]; 60 | } 61 | catch(Exception $e) 62 | { 63 | switch(get_class($e)) 64 | { 65 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 66 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 67 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 68 | default : return ['success' => false, 'messages' => get_class($e)]; 69 | } 70 | } 71 | } 72 | 73 | public function destroy($user_id) 74 | { 75 | try 76 | { 77 | $this->repository->delete($user_id); 78 | 79 | return [ 80 | 'success' => true, 81 | 'messages' => "Usuário removido.", 82 | 'data' => null, 83 | ]; 84 | } 85 | catch(Exception $e) 86 | { 87 | switch(get_class($e)) 88 | { 89 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 90 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 91 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 92 | default : return ['success' => false, 'messages' => get_class($e)]; 93 | } 94 | } 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | Build Status 5 | Total Downloads 6 | Latest Stable Version 7 | License 8 |

9 | 10 | ## About Laravel 11 | 12 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: 13 | 14 | - [Simple, fast routing engine](https://laravel.com/docs/routing). 15 | - [Powerful dependency injection container](https://laravel.com/docs/container). 16 | - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. 17 | - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). 18 | - Database agnostic [schema migrations](https://laravel.com/docs/migrations). 19 | - [Robust background job processing](https://laravel.com/docs/queues). 20 | - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). 21 | 22 | Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked. 23 | 24 | ## Learning Laravel 25 | 26 | Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is thorough, complete, and makes it a breeze to get started learning the framework. 27 | 28 | If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. 29 | 30 | ## Contributing 31 | 32 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions). 33 | 34 | ## Security Vulnerabilities 35 | 36 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed. 37 | 38 | ## License 39 | 40 | The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). 41 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Laravel {{ $title }} 9 | 10 | 11 | 12 | 13 | 14 | 66 | 67 | 68 |
69 | @if (Route::has('login')) 70 | 78 | @endif 79 | 80 |
81 |
82 | Laravel 83 |
84 | 85 | 92 |
93 |
94 | 95 | 96 | -------------------------------------------------------------------------------- /app/Services/GroupService.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 20 | $this->validator = $validator; 21 | } 22 | 23 | public function store(array $data) : array 24 | { 25 | try 26 | { 27 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE); 28 | $group = $this->repository->create($data); 29 | 30 | return [ 31 | 'success' => true, 32 | 'messages' => "Grupo cadasrado", 33 | 'data' => $group, 34 | ]; 35 | 36 | } 37 | catch(Exception $e) 38 | { 39 | switch(get_class($e)) 40 | { 41 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 42 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 43 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 44 | default : return ['success' => false, 'messages' => get_class($e)]; 45 | } 46 | } 47 | } 48 | 49 | 50 | public function update($group_id, array $data) : array 51 | { 52 | try 53 | { 54 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_UPDATE); 55 | $group = $this->repository->update($data, $group_id); 56 | 57 | return [ 58 | 'success' => true, 59 | 'messages' => "Grupo Atualizar", 60 | 'data' => $group, 61 | ]; 62 | } 63 | catch (Exception $e) 64 | { 65 | switch(get_class($e)) 66 | { 67 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 68 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 69 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 70 | default : return ['success' => false, 'messages' => get_class($e)]; 71 | } 72 | } 73 | } 74 | 75 | 76 | public function userStore($group_id, $data) 77 | { 78 | try 79 | { 80 | $group = $this->repository->find($group_id); 81 | $user_id = $data['user_id']; 82 | 83 | $group->users()->attach($user_id); 84 | 85 | return [ 86 | 'success' => true, 87 | 'messages' => "Usuário relacionado com sucesso!", 88 | 'data' => $group, 89 | ]; 90 | } 91 | catch(Exception $e) 92 | { 93 | dd($e); 94 | switch(get_class($e)) 95 | { 96 | case QueryException::class : return ['success' => false, 'messages' => $e->getMessage()]; 97 | case ValidatorException::class : return ['success' => false, 'messages' => $e->getMessageBag()]; 98 | case Exception::class : return ['success' => false, 'messages' => $e->getMessage()]; 99 | default : return ['success' => false, 'messages' => get_class($e)]; 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/Http/Controllers/MovimentsController.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 33 | $this->validator = $validator; 34 | } 35 | 36 | public function index() 37 | { 38 | return view('moviment.index', [ 39 | 'product_list' => Product::all(), 40 | ]); 41 | } 42 | 43 | public function application() 44 | { 45 | $user = Auth::user(); 46 | $group_list = $user->groups->pluck('name', 'id'); 47 | $product_list = Product::all()->pluck('name', 'id'); 48 | 49 | return view('moviment.application', [ 50 | 'group_list' => $group_list, 51 | 'product_list' => $product_list, 52 | ]); 53 | } 54 | 55 | public function storeApplication(Request $request) 56 | { 57 | $movimento = Moviment::create([ 58 | 'user_id' => Auth::user()->id, 59 | 'group_id' => $request->get('group_id'), 60 | 'product_id' => $request->get('product_id'), 61 | 'value' => $request->get('value'), 62 | 'type' => 1, 63 | ]); 64 | 65 | session()->flash('success', [ 66 | 'success' => true, 67 | 'messages' => "Sua aplicação de " . $movimento->value . " no produto " . $movimento->product->name . " foi realizada com sucesso!", 68 | ]); 69 | 70 | return redirect()->route('moviment.application'); 71 | } 72 | 73 | public function getback() 74 | { 75 | $user = Auth::user(); 76 | $group_list = $user->groups->pluck('name', 'id'); 77 | $product_list = Product::all()->pluck('name', 'id'); 78 | 79 | return view('moviment.getback', [ 80 | 'group_list' => $group_list, 81 | 'product_list' => $product_list, 82 | ]); 83 | } 84 | 85 | public function storeGetBack(Request $request) 86 | { 87 | $movimento = Moviment::create([ 88 | 'user_id' => Auth::user()->id, 89 | 'group_id' => $request->get('group_id'), 90 | 'product_id' => $request->get('product_id'), 91 | 'value' => $request->get('value'), 92 | 'type' => 2, 93 | ]); 94 | 95 | session()->flash('success', [ 96 | 'success' => true, 97 | 'messages' => "Seu resgate de " . $movimento->value . " no produto " . $movimento->product->name . " foi realizado com sucesso!", 98 | ]); 99 | 100 | return redirect()->route('moviment.application'); 101 | } 102 | 103 | public function all() 104 | { 105 | $moviment_list = Auth::user()->moviments; 106 | 107 | return view('moviment.all', [ 108 | 'moviment_list' => $moviment_list, 109 | ]); 110 | } 111 | } 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\Entities\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | You may specify multiple password reset configurations if you have more 85 | | than one user table or model in the application and you want to have 86 | | separate password reset settings based on the specific user types. 87 | | 88 | | The expire time is the number of minutes that the reset token should be 89 | | considered valid. This security feature keeps tokens short-lived so 90 | | they have less time to be guessed. You may change this as needed. 91 | | 92 | */ 93 | 94 | 'passwords' => [ 95 | 'users' => [ 96 | 'provider' => 'users', 97 | 'table' => 'password_resets', 98 | 'expire' => 60, 99 | ], 100 | ], 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /app/Http/Controllers/UsersController.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 25 | $this->service = $service; 26 | } 27 | 28 | 29 | /** 30 | * Display a listing of the resource. 31 | * 32 | * @return \Illuminate\Http\Response 33 | */ 34 | public function index() 35 | { 36 | $users = $this->repository->all(); 37 | 38 | return view('user.index', [ 39 | 'users' => $users 40 | ]); 41 | } 42 | 43 | /** 44 | * Store a newly created resource in storage. 45 | * 46 | * @param UserCreateRequest $request 47 | * 48 | * @return \Illuminate\Http\Response 49 | */ 50 | public function store(UserCreateRequest $request) 51 | { 52 | $request = $this->service->store($request->all()); 53 | $usuario = $request['success'] ? $request['data'] : null; 54 | 55 | session()->flash('success', [ 56 | 'success' => $request['success'], 57 | 'messages' => $request['messages'] 58 | ]); 59 | 60 | return redirect()->route('user.index'); 61 | } 62 | 63 | 64 | /** 65 | * Display the specified resource. 66 | * 67 | * @param int $id 68 | * 69 | * @return \Illuminate\Http\Response 70 | */ 71 | public function show($id) 72 | { 73 | $user = $this->repository->find($id); 74 | 75 | if (request()->wantsJson()) { 76 | 77 | return response()->json([ 78 | 'data' => $user, 79 | ]); 80 | } 81 | 82 | return view('users.show', compact('user')); 83 | } 84 | 85 | 86 | /** 87 | * Show the form for editing the specified resource. 88 | * 89 | * @param int $id 90 | * 91 | * @return \Illuminate\Http\Response 92 | */ 93 | public function edit($id) 94 | { 95 | $user = $this->repository->find($id); 96 | 97 | return view('user.edit', [ 98 | 'user' => $user 99 | ]); 100 | } 101 | 102 | 103 | /** 104 | * Update the specified resource in storage. 105 | * 106 | * @param UserUpdateRequest $request 107 | * @param string $id 108 | * 109 | * @return Response 110 | */ 111 | public function update(Request $request, $id) 112 | { 113 | $request = $this->service->update($request->all(), $id); 114 | $usuario = $request['success'] ? $request['data'] : null; 115 | 116 | session()->flash('success', [ 117 | 'success' => $request['success'], 118 | 'messages' => $request['messages'] 119 | ]); 120 | 121 | return redirect()->route('user.index'); 122 | } 123 | 124 | 125 | /** 126 | * Remove the specified resource from storage. 127 | * 128 | * @param int $id 129 | * 130 | * @return \Illuminate\Http\Response 131 | */ 132 | public function destroy($id) 133 | { 134 | $request = $this->service->destroy($id); 135 | 136 | session()->flash('success', [ 137 | 'success' => $request['success'], 138 | 'messages' => $request['messages'] 139 | ]); 140 | 141 | return redirect()->route('user.index'); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /app/Http/Controllers/InstituitionsController.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 26 | $this->validator = $validator; 27 | $this->service = $service; 28 | } 29 | 30 | 31 | /** 32 | * Display a listing of the resource. 33 | * 34 | * @return \Illuminate\Http\Response 35 | */ 36 | public function index() 37 | { 38 | $instituitions = $this->repository->all(); 39 | 40 | return view('instituitions.index', [ 41 | 'instituitions' => $instituitions, 42 | ]); 43 | } 44 | 45 | /** 46 | * Store a newly created resource in storage. 47 | * 48 | * @param InstituitionCreateRequest $request 49 | * 50 | * @return \Illuminate\Http\Response 51 | */ 52 | public function store(InstituitionCreateRequest $request) 53 | { 54 | $request = $this->service->store($request->all()); 55 | $instituition = $request['success'] ? $request['data'] : null; 56 | 57 | session()->flash('success', [ 58 | 'success' => $request['success'], 59 | 'messages' => $request['messages'] 60 | ]); 61 | 62 | return redirect()->route('instituition.index'); 63 | } 64 | 65 | 66 | /** 67 | * Display the specified resource. 68 | * 69 | * @param int $id 70 | * 71 | * @return \Illuminate\Http\Response 72 | */ 73 | public function show($id) 74 | { 75 | $instituition = $this->repository->find($id); 76 | 77 | return view('instituitions.show', [ 78 | 'instituition' => $instituition 79 | ]); 80 | } 81 | 82 | 83 | /** 84 | * Show the form for editing the specified resource. 85 | * 86 | * @param int $id 87 | * 88 | * @return \Illuminate\Http\Response 89 | */ 90 | public function edit($id) 91 | { 92 | $instituition = $this->repository->find($id); 93 | 94 | return view('instituitions.edit', [ 95 | 'instituition' => $instituition 96 | ]); 97 | } 98 | 99 | 100 | /** 101 | * Update the specified resource in storage. 102 | * 103 | * @param InstituitionUpdateRequest $request 104 | * @param string $id 105 | * 106 | * @return Response 107 | */ 108 | public function update(Request $request, $id) 109 | { 110 | $request = $this->service->update($request->all(), $id); 111 | $instituition = $request['success'] ? $request['data'] : null; 112 | 113 | session()->flash('success', [ 114 | 'success' => $request['success'], 115 | 'messages' => $request['messages'] 116 | ]); 117 | 118 | return redirect()->route('instituition.index'); 119 | } 120 | 121 | 122 | /** 123 | * Remove the specified resource from storage. 124 | * 125 | * @param int $id 126 | * 127 | * @return \Illuminate\Http\Response 128 | */ 129 | public function destroy($id) 130 | { 131 | $deleted = $this->repository->delete($id); 132 | return redirect()->route('instituition.index'); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Database Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here are each of the database connections setup for your application. 24 | | Of course, examples of configuring each database platform that is 25 | | supported by Laravel is shown below to make development simple. 26 | | 27 | | 28 | | All database work in Laravel is done through the PHP PDO facilities 29 | | so make sure you have the driver for your particular database of 30 | | choice installed on your machine before you begin development. 31 | | 32 | */ 33 | 34 | 'connections' => [ 35 | 36 | 'sqlite' => [ 37 | 'driver' => 'sqlite', 38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 39 | 'prefix' => '', 40 | ], 41 | 42 | 'mysql' => [ 43 | 'driver' => 'mysql', 44 | 'host' => env('DB_HOST', '127.0.0.1'), 45 | 'port' => env('DB_PORT', '3306'), 46 | 'database' => env('DB_DATABASE', 'forge'), 47 | 'username' => env('DB_USERNAME', 'forge'), 48 | 'password' => env('DB_PASSWORD', ''), 49 | 'charset' => 'utf8mb4', 50 | 'collation' => 'utf8mb4_unicode_ci', 51 | 'prefix' => '', 52 | 'strict' => true, 53 | 'engine' => null, 54 | ], 55 | 56 | 'pgsql' => [ 57 | 'driver' => 'pgsql', 58 | 'host' => env('DB_HOST', '127.0.0.1'), 59 | 'port' => env('DB_PORT', '5432'), 60 | 'database' => env('DB_DATABASE', 'forge'), 61 | 'username' => env('DB_USERNAME', 'forge'), 62 | 'password' => env('DB_PASSWORD', ''), 63 | 'charset' => 'utf8', 64 | 'prefix' => '', 65 | 'schema' => 'public', 66 | 'sslmode' => 'prefer', 67 | ], 68 | 69 | ], 70 | 71 | /* 72 | |-------------------------------------------------------------------------- 73 | | Migration Repository Table 74 | |-------------------------------------------------------------------------- 75 | | 76 | | This table keeps track of all the migrations that have already run for 77 | | your application. Using this information, we can determine which of 78 | | the migrations on disk haven't actually been run in the database. 79 | | 80 | */ 81 | 82 | 'migrations' => 'migrations', 83 | 84 | /* 85 | |-------------------------------------------------------------------------- 86 | | Redis Databases 87 | |-------------------------------------------------------------------------- 88 | | 89 | | Redis is an open source, fast, and advanced key-value store that also 90 | | provides a richer set of commands than a typical key-value systems 91 | | such as APC or Memcached. Laravel makes it easy to dig right in. 92 | | 93 | */ 94 | 95 | 'redis' => [ 96 | 97 | 'client' => 'predis', 98 | 99 | 'default' => [ 100 | 'host' => env('REDIS_HOST', '127.0.0.1'), 101 | 'password' => env('REDIS_PASSWORD', null), 102 | 'port' => env('REDIS_PORT', 6379), 103 | 'database' => 0, 104 | ], 105 | 106 | ], 107 | 108 | ]; 109 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => [ 59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 60 | 'name' => env('MAIL_FROM_NAME', 'Example'), 61 | ], 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | E-Mail Encryption Protocol 66 | |-------------------------------------------------------------------------- 67 | | 68 | | Here you may specify the encryption protocol that should be used when 69 | | the application send e-mail messages. A sensible default using the 70 | | transport layer security protocol should provide great security. 71 | | 72 | */ 73 | 74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | SMTP Server Username 79 | |-------------------------------------------------------------------------- 80 | | 81 | | If your SMTP server requires a username for authentication, you should 82 | | set it here. This will get used to authenticate with your server on 83 | | connection. You may also set the "password" value below this one. 84 | | 85 | */ 86 | 87 | 'username' => env('MAIL_USERNAME'), 88 | 89 | 'password' => env('MAIL_PASSWORD'), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Sendmail System Path 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When using the "sendmail" driver to send e-mails, we will need to know 97 | | the path to where Sendmail lives on this server. A default path has 98 | | been provided here, which will work well on most of your systems. 99 | | 100 | */ 101 | 102 | 'sendmail' => '/usr/sbin/sendmail -bs', 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Markdown Mail Settings 107 | |-------------------------------------------------------------------------- 108 | | 109 | | If you are using Markdown based email rendering, you may configure your 110 | | theme and component paths here, allowing you to customize the design 111 | | of the emails. Or, you may simply stick with the Laravel defaults! 112 | | 113 | */ 114 | 115 | 'markdown' => [ 116 | 'theme' => 'default', 117 | 118 | 'paths' => [ 119 | resource_path('views/vendor/mail'), 120 | ], 121 | ], 122 | 123 | ]; 124 | -------------------------------------------------------------------------------- /app/Http/Controllers/GroupsController.php: -------------------------------------------------------------------------------- 1 | instituitionRepository = $instituitionRepository; 31 | $this->userRepository = $userRepository; 32 | $this->repository = $repository; 33 | $this->validator = $validator; 34 | $this->service = $service; 35 | } 36 | 37 | 38 | /** 39 | * Display a listing of the resource. 40 | * 41 | * @return \Illuminate\Http\Response 42 | */ 43 | public function index() 44 | { 45 | $groups = $this->repository->all(); 46 | $user_list = $this->userRepository->selectBoxList(); 47 | $instituition_list = $this->instituitionRepository->selectBoxList(); 48 | 49 | return view('groups.index', [ 50 | 'groups' => $groups, 51 | 'user_list' => $user_list, 52 | 'instituition_list' => $instituition_list, 53 | ]); 54 | } 55 | 56 | /** 57 | * Store a newly created resource in storage. 58 | * 59 | * @param GroupCreateRequest $request 60 | * 61 | * @return \Illuminate\Http\Response 62 | */ 63 | public function store(GroupCreateRequest $request) 64 | { 65 | $request = $this->service->store($request->all()); 66 | $group = $request['success'] ? $request['data'] : null; 67 | 68 | session()->flash('success', [ 69 | 'success' => $request['success'], 70 | 'messages' => $request['messages'] 71 | ]); 72 | 73 | return redirect()->route('group.index'); 74 | } 75 | 76 | 77 | public function userStore(Request $request, $group_id) 78 | { 79 | $request = $this->service->userStore($group_id, $request->all()); 80 | 81 | session()->flash('success', [ 82 | 'success' => $request['success'], 83 | 'messages' => $request['messages'] 84 | ]); 85 | 86 | return redirect()->route('group.show', [$group_id]); 87 | } 88 | 89 | 90 | /** 91 | * Display the specified resource. 92 | * 93 | * @param int $id 94 | * 95 | * @return \Illuminate\Http\Response 96 | */ 97 | public function show($id) 98 | { 99 | $group = $this->repository->find($id); 100 | $user_list = $this->userRepository->selectBoxList(); 101 | 102 | return view('groups.show', [ 103 | 'group' => $group, 104 | 'user_list' => $user_list 105 | ]); 106 | } 107 | 108 | 109 | public function edit($id) 110 | { 111 | $group = Group::find($id); 112 | $user_list = $this->userRepository->selectBoxList(); 113 | $instituition_list = $this->instituitionRepository->selectBoxList(); 114 | 115 | return view('groups.edit', [ 116 | 'group' => $group, 117 | 'user_list' => $user_list, 118 | 'instituition_list' => $instituition_list, 119 | ]); 120 | } 121 | 122 | 123 | /** 124 | * Update the specified resource in storage. 125 | * 126 | * @param GroupUpdateRequest $request 127 | * @param string $id 128 | * 129 | * @return Response 130 | */ 131 | public function update(Request $request, $group_id) 132 | { 133 | $request = $this->service->update( (int) $group_id, $request->all()); 134 | 135 | session()->flash('success', [ 136 | 'success' => $request['success'], 137 | 'messages' => $request['messages'] 138 | ]); 139 | 140 | return redirect()->route('group.index'); 141 | } 142 | 143 | 144 | /** 145 | * Remove the specified resource from storage. 146 | * 147 | * @param int $id 148 | * 149 | * @return \Illuminate\Http\Response 150 | */ 151 | public function destroy($id) 152 | { 153 | $deleted = $this->repository->delete($id); 154 | return redirect()->route('group.index'); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /public/css/stylesheet.css: -------------------------------------------------------------------------------- 1 | *{ 2 | padding: 0; 3 | margin: 0; 4 | list-style: none; 5 | outline: none; 6 | border: none; 7 | 8 | -webkit-box-sizing: border-box; 9 | -moz-box-sizing: border-box; 10 | -box-sizing: border-box; 11 | } 12 | body{ 13 | background: #f7f7f7; 14 | } 15 | 16 | 17 | /** 18 | * ======================================================== * 19 | * stylesheet to login pages 20 | * ======================================================== * 21 | */ 22 | div.background{ 23 | position: absolute; 24 | left: 0; 25 | width: calc(100% - 300px); 26 | height: 100%; 27 | background-image: url(../assets/images/login-background.jpg); 28 | background-size: cover; 29 | } 30 | section#conteudo-view{ 31 | position: absolute; 32 | right: 0; 33 | padding: 20px; 34 | float: right; 35 | width: 300px; 36 | height: 100%; 37 | background: #51dca6; 38 | } 39 | section#conteudo-view h1{ 40 | float: left; 41 | width: 100%; 42 | font: 3em 'Fredoka One', cursive; 43 | margin-top: 50px; 44 | color: #f3f3f3; 45 | } 46 | section#conteudo-view h3, 47 | section#conteudo-view form p{ 48 | float: left; 49 | width: 100%; 50 | font: .8em 'Fredoka One', cursive; 51 | color: #f3f3f3; 52 | } 53 | section#conteudo-view form, 54 | section#conteudo-view form label{ 55 | float: left; 56 | width: 100%; 57 | margin-bottom: 10px; 58 | } 59 | section#conteudo-view form{ 60 | margin-top: 40px; 61 | } 62 | section#conteudo-view form p{ 63 | font-size: 1.25em; 64 | } 65 | section#conteudo-view form input[type="submit"], 66 | section#conteudo-view form label input{ 67 | float: left; 68 | width: 100%; 69 | height: 40px; 70 | padding: 0 20px; 71 | border-radius: 20px; 72 | border: 2px solid #52ca9b; 73 | color: #959595; 74 | font: 1em 'Arial'; 75 | } 76 | section#conteudo-view form input[type="submit"]{ 77 | width: 60%; 78 | float: right; 79 | background: #00ff9c; 80 | text-align: center; 81 | color: #f9f9f9; 82 | font: 1em 'Fredoka One', cursive; 83 | } 84 | 85 | 86 | 87 | /** 88 | * ======================================================== * 89 | * stylesheet to menu lateral 90 | * ======================================================== * 91 | */ 92 | #principal{ 93 | position: fixed; 94 | float: left; 95 | width: 220px; 96 | height: 100%; 97 | background: #fff; 98 | z-index: 5; 99 | border-right: 1px solid #e9e9e9; 100 | box-shadow: 0 0 15px rgba(0,0,0,.15); 101 | } 102 | #principal ul, 103 | #principal ul li{ 104 | float: left; 105 | width: 100%; 106 | } 107 | #principal ul li a{ 108 | float: left; 109 | width: 100%; 110 | height: 80px; 111 | color: #9C9C9C; 112 | border-bottom: 1px solid #e9e9e9; 113 | } 114 | #principal ul li a i{ 115 | float: left; 116 | height: 80px; 117 | width: 80px; 118 | color: inherit; 119 | text-align: center; 120 | line-height: 80px; 121 | font-size: 2em; 122 | } 123 | #principal ul li a h3{ 124 | float: left; 125 | height: 80px; 126 | font: 1.25em/80px 'Fredoka One', cursive; 127 | color: inherit; 128 | } 129 | #principal ul li a:hover{ 130 | color: #00ff9c; 131 | } 132 | 133 | 134 | 135 | /** 136 | * ======================================================== * 137 | * stylesheet 138 | * ======================================================== * 139 | */ 140 | #view-conteudo{ 141 | position: fixed; 142 | float: left; 143 | width: 100%; 144 | height: 100%; 145 | padding: 20px 20px 20px 240px; 146 | z-index: 1; 147 | } 148 | 149 | 150 | 151 | /** 152 | * ======================================================== * 153 | * stylesheet 154 | * ======================================================== * 155 | */ 156 | form.form-padrao{ 157 | float: left; 158 | width: 100%; 159 | } 160 | form.form-padrao label{ 161 | float: left; 162 | width: 49%; 163 | height: 60px; 164 | padding: 7px 15px; 165 | border: 1px solid #e9e9e9; 166 | background: #fff; 167 | border-radius: 5px; 168 | margin-bottom: 20px; 169 | } 170 | form.form-padrao label:nth-last-of-type(odd){ 171 | margin-left: 2%; 172 | } 173 | form.form-padrao label span{ 174 | float: left; 175 | width: 100%; 176 | font: 400 .75em 'Arial'; 177 | color: #c7c7c7; 178 | padding-bottom: 5px; 179 | } 180 | form.form-padrao label input{ 181 | float: left; 182 | width: 100%; 183 | color: #5c5c5c; 184 | font: 400 1.25em 'Arial'; 185 | background: transparent; 186 | } 187 | form.form-padrao label.submit{ 188 | background: #0ad181; 189 | border-color: #0aaa67; 190 | } 191 | form.form-padrao label.submit input{ 192 | font-weight: 800; 193 | text-transform: uppercase; 194 | line-height: 50px; 195 | color: #f9f9f9; 196 | } 197 | 198 | .default-table{ 199 | float: left; 200 | width: 100%; 201 | background: #fff; 202 | border: 1px solid #e9e9e9; 203 | padding: 10px; 204 | font: 400 .9em 'Arial'; 205 | color: #5c5c5c; 206 | } 207 | .default-table thead{ 208 | text-transform: uppercase; 209 | font-size: .8em; 210 | font-weight: 800; 211 | } 212 | .default-table thead tr{ 213 | height: 40px; 214 | } 215 | .default-table tbody tr{ 216 | height: 20px; 217 | } -------------------------------------------------------------------------------- /app/Http/Controllers/ProductsController.php: -------------------------------------------------------------------------------- 1 | repository = $repository; 32 | $this->validator = $validator; 33 | } 34 | 35 | 36 | /** 37 | * Display a listing of the resource. 38 | * 39 | * @return \Illuminate\Http\Response 40 | */ 41 | public function index($instituition_id) 42 | { 43 | $instituition = Instituition::find($instituition_id); 44 | 45 | return view('instituitions.product.index', [ 46 | 'instituition' => $instituition 47 | ]); 48 | } 49 | 50 | /** 51 | * Store a newly created resource in storage. 52 | * 53 | * @param ProductCreateRequest $request 54 | * 55 | * @return \Illuminate\Http\Response 56 | */ 57 | public function store(Request $request, $instituition_id) 58 | { 59 | try 60 | { 61 | $data = $request->all(); 62 | $data['instituition_id'] = $instituition_id; 63 | 64 | $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE); 65 | $product = $this->repository->create($data); 66 | 67 | session()->flash('success', [ 68 | 'success' => true, 69 | 'messages' => "produto cadastrado" 70 | ]); 71 | 72 | return redirect()->route('instituition.product.index', $instituition_id); 73 | } 74 | catch (ValidatorException $e) { 75 | return redirect()->back()->withErrors($e->getMessageBag())->withInput(); 76 | } 77 | } 78 | 79 | 80 | /** 81 | * Display the specified resource. 82 | * 83 | * @param int $id 84 | * 85 | * @return \Illuminate\Http\Response 86 | */ 87 | public function show($id) 88 | { 89 | $product = $this->repository->find($id); 90 | 91 | if (request()->wantsJson()) { 92 | 93 | return response()->json([ 94 | 'data' => $product, 95 | ]); 96 | } 97 | 98 | return view('products.show', compact('product')); 99 | } 100 | 101 | 102 | /** 103 | * Show the form for editing the specified resource. 104 | * 105 | * @param int $id 106 | * 107 | * @return \Illuminate\Http\Response 108 | */ 109 | public function edit($id) 110 | { 111 | 112 | $product = $this->repository->find($id); 113 | 114 | return view('products.edit', compact('product')); 115 | } 116 | 117 | 118 | /** 119 | * Update the specified resource in storage. 120 | * 121 | * @param ProductUpdateRequest $request 122 | * @param string $id 123 | * 124 | * @return Response 125 | */ 126 | public function update(ProductUpdateRequest $request, $id) 127 | { 128 | 129 | try { 130 | 131 | $this->validator->with($request->all())->passesOrFail(ValidatorInterface::RULE_UPDATE); 132 | 133 | $product = $this->repository->update($request->all(), $id); 134 | 135 | $response = [ 136 | 'message' => 'Product updated.', 137 | 'data' => $product->toArray(), 138 | ]; 139 | 140 | if ($request->wantsJson()) { 141 | 142 | return response()->json($response); 143 | } 144 | 145 | return redirect()->back()->with('message', $response['message']); 146 | } catch (ValidatorException $e) { 147 | 148 | if ($request->wantsJson()) { 149 | 150 | return response()->json([ 151 | 'error' => true, 152 | 'message' => $e->getMessageBag() 153 | ]); 154 | } 155 | 156 | return redirect()->back()->withErrors($e->getMessageBag())->withInput(); 157 | } 158 | } 159 | 160 | 161 | /** 162 | * Remove the specified resource from storage. 163 | * 164 | * @param int $id 165 | * 166 | * @return \Illuminate\Http\Response 167 | */ 168 | public function destroy($instituition_id, $product_id) 169 | { 170 | $deleted = $this->repository->delete($product_id); 171 | 172 | session()->flash('success', [ 173 | 'success' => true, 174 | 'messages' => "Produto removido" 175 | ]); 176 | return redirect()->back(); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /resources/views/vendor/mail/html/themes/default.css: -------------------------------------------------------------------------------- 1 | /* Base */ 2 | 3 | body, body *:not(html):not(style):not(br):not(tr):not(code) { 4 | font-family: Avenir, Helvetica, sans-serif; 5 | box-sizing: border-box; 6 | } 7 | 8 | body { 9 | background-color: #F2F4F6; 10 | color: #74787E; 11 | height: 100%; 12 | line-height: 1.4; 13 | margin: 0; 14 | width: 100% !important; 15 | -webkit-text-size-adjust: none; 16 | } 17 | 18 | p, 19 | ul, 20 | ol, 21 | blockquote { 22 | line-height: 1.4; 23 | text-align: left; 24 | } 25 | 26 | a { 27 | color: #3869D4; 28 | } 29 | 30 | a img { 31 | border: none; 32 | } 33 | 34 | /* Typography */ 35 | 36 | h1 { 37 | color: #2F3133; 38 | font-size: 19px; 39 | font-weight: bold; 40 | margin-top: 0; 41 | text-align: left; 42 | } 43 | 44 | h2 { 45 | color: #2F3133; 46 | font-size: 16px; 47 | font-weight: bold; 48 | margin-top: 0; 49 | text-align: left; 50 | } 51 | 52 | h3 { 53 | color: #2F3133; 54 | font-size: 14px; 55 | font-weight: bold; 56 | margin-top: 0; 57 | text-align: left; 58 | } 59 | 60 | p { 61 | color: #74787E; 62 | font-size: 16px; 63 | line-height: 1.5em; 64 | margin-top: 0; 65 | text-align: left; 66 | } 67 | 68 | p.sub { 69 | font-size: 12px; 70 | } 71 | 72 | img { 73 | max-width: 100%; 74 | } 75 | 76 | /* Layout */ 77 | 78 | .wrapper { 79 | background-color: #f5f8fa; 80 | margin: 0; 81 | padding: 0; 82 | width: 100%; 83 | -premailer-cellpadding: 0; 84 | -premailer-cellspacing: 0; 85 | -premailer-width: 100%; 86 | } 87 | 88 | .content { 89 | margin: 0; 90 | padding: 0; 91 | width: 100%; 92 | -premailer-cellpadding: 0; 93 | -premailer-cellspacing: 0; 94 | -premailer-width: 100%; 95 | } 96 | 97 | /* Header */ 98 | 99 | .header { 100 | padding: 25px 0; 101 | text-align: center; 102 | } 103 | 104 | .header a { 105 | color: #bbbfc3; 106 | font-size: 19px; 107 | font-weight: bold; 108 | text-decoration: none; 109 | text-shadow: 0 1px 0 white; 110 | } 111 | 112 | /* Body */ 113 | 114 | .body { 115 | background-color: #FFFFFF; 116 | border-bottom: 1px solid #EDEFF2; 117 | border-top: 1px solid #EDEFF2; 118 | margin: 0; 119 | padding: 0; 120 | width: 100%; 121 | -premailer-cellpadding: 0; 122 | -premailer-cellspacing: 0; 123 | -premailer-width: 100%; 124 | } 125 | 126 | .inner-body { 127 | background-color: #FFFFFF; 128 | margin: 0 auto; 129 | padding: 0; 130 | width: 570px; 131 | -premailer-cellpadding: 0; 132 | -premailer-cellspacing: 0; 133 | -premailer-width: 570px; 134 | } 135 | 136 | /* Subcopy */ 137 | 138 | .subcopy { 139 | border-top: 1px solid #EDEFF2; 140 | margin-top: 25px; 141 | padding-top: 25px; 142 | } 143 | 144 | .subcopy p { 145 | font-size: 12px; 146 | } 147 | 148 | /* Footer */ 149 | 150 | .footer { 151 | margin: 0 auto; 152 | padding: 0; 153 | text-align: center; 154 | width: 570px; 155 | -premailer-cellpadding: 0; 156 | -premailer-cellspacing: 0; 157 | -premailer-width: 570px; 158 | } 159 | 160 | .footer p { 161 | color: #AEAEAE; 162 | font-size: 12px; 163 | text-align: center; 164 | } 165 | 166 | /* Tables */ 167 | 168 | .table table { 169 | margin: 30px auto; 170 | width: 100%; 171 | -premailer-cellpadding: 0; 172 | -premailer-cellspacing: 0; 173 | -premailer-width: 100%; 174 | } 175 | 176 | .table th { 177 | border-bottom: 1px solid #EDEFF2; 178 | padding-bottom: 8px; 179 | } 180 | 181 | .table td { 182 | color: #74787E; 183 | font-size: 15px; 184 | line-height: 18px; 185 | padding: 10px 0; 186 | } 187 | 188 | .content-cell { 189 | padding: 35px; 190 | } 191 | 192 | /* Buttons */ 193 | 194 | .action { 195 | margin: 30px auto; 196 | padding: 0; 197 | text-align: center; 198 | width: 100%; 199 | -premailer-cellpadding: 0; 200 | -premailer-cellspacing: 0; 201 | -premailer-width: 100%; 202 | } 203 | 204 | .button { 205 | border-radius: 3px; 206 | box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); 207 | color: #FFF; 208 | display: inline-block; 209 | text-decoration: none; 210 | -webkit-text-size-adjust: none; 211 | } 212 | 213 | .button-blue { 214 | background-color: #3097D1; 215 | border-top: 10px solid #3097D1; 216 | border-right: 18px solid #3097D1; 217 | border-bottom: 10px solid #3097D1; 218 | border-left: 18px solid #3097D1; 219 | } 220 | 221 | .button-green { 222 | background-color: #2ab27b; 223 | border-top: 10px solid #2ab27b; 224 | border-right: 18px solid #2ab27b; 225 | border-bottom: 10px solid #2ab27b; 226 | border-left: 18px solid #2ab27b; 227 | } 228 | 229 | .button-red { 230 | background-color: #bf5329; 231 | border-top: 10px solid #bf5329; 232 | border-right: 18px solid #bf5329; 233 | border-bottom: 10px solid #bf5329; 234 | border-left: 18px solid #bf5329; 235 | } 236 | 237 | /* Panels */ 238 | 239 | .panel { 240 | margin: 0 0 21px; 241 | } 242 | 243 | .panel-content { 244 | background-color: #EDEFF2; 245 | padding: 16px; 246 | } 247 | 248 | .panel-item { 249 | padding: 0; 250 | } 251 | 252 | .panel-item p:last-of-type { 253 | margin-bottom: 0; 254 | padding-bottom: 0; 255 | } 256 | 257 | /* Promotions */ 258 | 259 | .promotion { 260 | background-color: #FFFFFF; 261 | border: 2px dashed #9BA2AB; 262 | margin: 0; 263 | margin-bottom: 25px; 264 | margin-top: 25px; 265 | padding: 24px; 266 | width: 100%; 267 | -premailer-cellpadding: 0; 268 | -premailer-cellspacing: 0; 269 | -premailer-width: 100%; 270 | } 271 | 272 | .promotion h1 { 273 | text-align: center; 274 | } 275 | 276 | .promotion p { 277 | font-size: 15px; 278 | text-align: center; 279 | } 280 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | 'The :attribute must be accepted.', 17 | 'active_url' => 'The :attribute is not a valid URL.', 18 | 'after' => 'The :attribute must be a date after :date.', 19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', 20 | 'alpha' => 'The :attribute may only contain letters.', 21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', 22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.', 23 | 'array' => 'The :attribute must be an array.', 24 | 'before' => 'The :attribute must be a date before :date.', 25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 26 | 'between' => [ 27 | 'numeric' => 'The :attribute must be between :min and :max.', 28 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 29 | 'string' => 'The :attribute must be between :min and :max characters.', 30 | 'array' => 'The :attribute must have between :min and :max items.', 31 | ], 32 | 'boolean' => 'The :attribute field must be true or false.', 33 | 'confirmed' => 'The :attribute confirmation does not match.', 34 | 'date' => 'The :attribute is not a valid date.', 35 | 'date_format' => 'The :attribute does not match the format :format.', 36 | 'different' => 'The :attribute and :other must be different.', 37 | 'digits' => 'The :attribute must be :digits digits.', 38 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 39 | 'dimensions' => 'The :attribute has invalid image dimensions.', 40 | 'distinct' => 'The :attribute field has a duplicate value.', 41 | 'email' => 'The :attribute must be a valid email address.', 42 | 'exists' => 'The selected :attribute is invalid.', 43 | 'file' => 'The :attribute must be a file.', 44 | 'filled' => 'The :attribute field is required.', 45 | 'image' => 'The :attribute must be an image.', 46 | 'in' => 'The selected :attribute is invalid.', 47 | 'in_array' => 'The :attribute field does not exist in :other.', 48 | 'integer' => 'The :attribute must be an integer.', 49 | 'ip' => 'The :attribute must be a valid IP address.', 50 | 'json' => 'The :attribute must be a valid JSON string.', 51 | 'max' => [ 52 | 'numeric' => 'The :attribute may not be greater than :max.', 53 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 54 | 'string' => 'The :attribute may not be greater than :max characters.', 55 | 'array' => 'The :attribute may not have more than :max items.', 56 | ], 57 | 'mimes' => 'The :attribute must be a file of type: :values.', 58 | 'mimetypes' => 'The :attribute must be a file of type: :values.', 59 | 'min' => [ 60 | 'numeric' => 'The :attribute must be at least :min.', 61 | 'file' => 'The :attribute must be at least :min kilobytes.', 62 | 'string' => 'The :attribute must be at least :min characters.', 63 | 'array' => 'The :attribute must have at least :min items.', 64 | ], 65 | 'not_in' => 'The selected :attribute is invalid.', 66 | 'numeric' => 'The :attribute must be a number.', 67 | 'present' => 'The :attribute field must be present.', 68 | 'regex' => 'The :attribute format is invalid.', 69 | 'required' => 'The :attribute field is required.', 70 | 'required_if' => 'The :attribute field is required when :other is :value.', 71 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 72 | 'required_with' => 'The :attribute field is required when :values is present.', 73 | 'required_with_all' => 'The :attribute field is required when :values is present.', 74 | 'required_without' => 'The :attribute field is required when :values is not present.', 75 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 76 | 'same' => 'The :attribute and :other must match.', 77 | 'size' => [ 78 | 'numeric' => 'The :attribute must be :size.', 79 | 'file' => 'The :attribute must be :size kilobytes.', 80 | 'string' => 'The :attribute must be :size characters.', 81 | 'array' => 'The :attribute must contain :size items.', 82 | ], 83 | 'string' => 'The :attribute must be a string.', 84 | 'timezone' => 'The :attribute must be a valid zone.', 85 | 'unique' => 'The :attribute has already been taken.', 86 | 'uploaded' => 'The :attribute failed to upload.', 87 | 'url' => 'The :attribute format is invalid.', 88 | 89 | /* 90 | |-------------------------------------------------------------------------- 91 | | Custom Validation Language Lines 92 | |-------------------------------------------------------------------------- 93 | | 94 | | Here you may specify custom validation messages for attributes using the 95 | | convention "attribute.rule" to name the lines. This makes it quick to 96 | | specify a specific custom language line for a given attribute rule. 97 | | 98 | */ 99 | 100 | 'custom' => [ 101 | 'attribute-name' => [ 102 | 'rule-name' => 'custom-message', 103 | ], 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Custom Validation Attributes 109 | |-------------------------------------------------------------------------- 110 | | 111 | | The following language lines are used to swap attribute place-holders 112 | | with something more reader friendly such as E-Mail Address instead 113 | | of "email". This simply helps us make messages a little cleaner. 114 | | 115 | */ 116 | 117 | 'attributes' => [], 118 | 119 | ]; 120 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session Encryption 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This option allows you to easily specify that all of your session data 42 | | should be encrypted before it is stored. All encryption will be run 43 | | automatically by Laravel and you can use the Session like normal. 44 | | 45 | */ 46 | 47 | 'encrypt' => false, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session File Location 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the native session driver, we need a location where session 55 | | files may be stored. A default has been set for you but a different 56 | | location may be specified. This is only needed for file sessions. 57 | | 58 | */ 59 | 60 | 'files' => storage_path('framework/sessions'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Connection 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" or "redis" session drivers, you may specify a 68 | | connection that should be used to manage these sessions. This should 69 | | correspond to a connection in your database configuration options. 70 | | 71 | */ 72 | 73 | 'connection' => null, 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Database Table 78 | |-------------------------------------------------------------------------- 79 | | 80 | | When using the "database" session driver, you may specify the table we 81 | | should use to manage the sessions. Of course, a sensible default is 82 | | provided for you; however, you are free to change this as needed. 83 | | 84 | */ 85 | 86 | 'table' => 'sessions', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Cache Store 91 | |-------------------------------------------------------------------------- 92 | | 93 | | When using the "apc" or "memcached" session drivers, you may specify a 94 | | cache store that should be used for these sessions. This value must 95 | | correspond with one of the application's configured cache stores. 96 | | 97 | */ 98 | 99 | 'store' => null, 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Sweeping Lottery 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Some session drivers must manually sweep their storage location to get 107 | | rid of old sessions from storage. Here are the chances that it will 108 | | happen on a given request. By default, the odds are 2 out of 100. 109 | | 110 | */ 111 | 112 | 'lottery' => [2, 100], 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Name 117 | |-------------------------------------------------------------------------- 118 | | 119 | | Here you may change the name of the cookie used to identify a session 120 | | instance by ID. The name specified here will get used every time a 121 | | new session cookie is created by the framework for every driver. 122 | | 123 | */ 124 | 125 | 'cookie' => 'laravel_session', 126 | 127 | /* 128 | |-------------------------------------------------------------------------- 129 | | Session Cookie Path 130 | |-------------------------------------------------------------------------- 131 | | 132 | | The session cookie path determines the path for which the cookie will 133 | | be regarded as available. Typically, this will be the root path of 134 | | your application but you are free to change this when necessary. 135 | | 136 | */ 137 | 138 | 'path' => '/', 139 | 140 | /* 141 | |-------------------------------------------------------------------------- 142 | | Session Cookie Domain 143 | |-------------------------------------------------------------------------- 144 | | 145 | | Here you may change the domain of the cookie used to identify a session 146 | | in your application. This will determine which domains the cookie is 147 | | available to in your application. A sensible default has been set. 148 | | 149 | */ 150 | 151 | 'domain' => env('SESSION_DOMAIN', null), 152 | 153 | /* 154 | |-------------------------------------------------------------------------- 155 | | HTTPS Only Cookies 156 | |-------------------------------------------------------------------------- 157 | | 158 | | By setting this option to true, session cookies will only be sent back 159 | | to the server if the browser has a HTTPS connection. This will keep 160 | | the cookie from being sent to you if it can not be done securely. 161 | | 162 | */ 163 | 164 | 'secure' => env('SESSION_SECURE_COOKIE', false), 165 | 166 | /* 167 | |-------------------------------------------------------------------------- 168 | | HTTP Access Only 169 | |-------------------------------------------------------------------------- 170 | | 171 | | Setting this value to true will prevent JavaScript from accessing the 172 | | value of the cookie and the cookie will only be accessible through 173 | | the HTTP protocol. You are free to modify this option if needed. 174 | | 175 | */ 176 | 177 | 'http_only' => true, 178 | 179 | ]; 180 | --------------------------------------------------------------------------------