├── resources
├── css
│ └── app.css
├── js
│ ├── app.js
│ └── bootstrap.js
├── views
│ ├── errors
│ │ ├── 404.blade.php
│ │ ├── 401.blade.php
│ │ ├── 419.blade.php
│ │ ├── 500.blade.php
│ │ ├── 429.blade.php
│ │ ├── 503.blade.php
│ │ ├── 403.blade.php
│ │ └── layout.blade.php
│ ├── layouts
│ │ └── AdminLTE
│ │ │ ├── _includes
│ │ │ ├── _footer.blade.php
│ │ │ ├── _menu_lateral.blade.php
│ │ │ ├── _menu_superior.blade.php
│ │ │ ├── _data_tables.blade.php
│ │ │ ├── _script_footer.blade.php
│ │ │ └── _head.blade.php
│ │ │ └── index.blade.php
│ ├── auth
│ │ ├── passwords
│ │ │ ├── email.blade.php
│ │ │ └── reset.blade.php
│ │ ├── login.blade.php
│ │ └── register.blade.php
│ └── users
│ │ ├── edit_password.blade.php
│ │ ├── show.blade.php
│ │ ├── roles
│ │ ├── index.blade.php
│ │ ├── show.blade.php
│ │ ├── create.blade.php
│ │ └── edit.blade.php
│ │ ├── index.blade.php
│ │ └── edit.blade.php
└── lang
│ ├── en
│ ├── pagination.php
│ ├── auth.php
│ └── passwords.php
│ ├── pt_BR
│ ├── pagination.php
│ ├── auth.php
│ └── passwords.php
│ └── pt_BR.json
├── database
├── .gitignore
├── migrations
│ ├── 2023_10_04_171516_add_register_to_configs_table.php
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ ├── 2023_10_04_141357_add_default_role_id_to_configs_table.php
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2018_04_28_115529_create_roles_table.php
│ ├── 2018_04_09_172746_create_configs_table.php
│ └── 2018_04_28_115600_create_permissions_table.php
├── seeders
│ ├── ConfigTableSeeder.php
│ ├── DatabaseSeeder.php
│ ├── RoleUserTablesSeeder.php
│ └── PermissionRoleTablesSeeder.php
└── factories
│ └── UserFactory.php
├── bootstrap
├── cache
│ └── .gitignore
└── app.php
├── public
├── assets
│ └── .gitignore
├── robots.txt
├── img
│ └── config
│ │ ├── logo.png
│ │ ├── nopic.png
│ │ ├── favicon.png
│ │ └── dashboard.png
├── custom
│ └── style.css
├── .htaccess
├── web.config
└── index.php
├── storage
├── logs
│ └── .gitignore
├── app
│ ├── public
│ │ └── .gitignore
│ └── .gitignore
└── framework
│ ├── testing
│ └── .gitignore
│ ├── views
│ └── .gitignore
│ ├── cache
│ ├── data
│ │ └── .gitignore
│ └── .gitignore
│ ├── sessions
│ └── .gitignore
│ └── .gitignore
├── VsCode.exe
├── .gitattributes
├── app
├── Http
│ ├── Requests
│ │ ├── Request.php
│ │ ├── User
│ │ │ ├── StoreRoleRequest.php
│ │ │ ├── UpdateRoleRequest.php
│ │ │ ├── UpdatePasswordUserRequest.php
│ │ │ ├── UpdateUserRequest.php
│ │ │ └── StoreUserRequest.php
│ │ ├── Profile
│ │ │ ├── UpdateAvatarProfileRequest.php
│ │ │ ├── UpdatePasswordProfileRequest.php
│ │ │ └── UpdateProfileRequest.php
│ │ └── ConfigRequest.php
│ ├── Middleware
│ │ ├── EncryptCookies.php
│ │ ├── VerifyCsrfToken.php
│ │ ├── TrustHosts.php
│ │ ├── PreventRequestsDuringMaintenance.php
│ │ ├── TrimStrings.php
│ │ ├── Authenticate.php
│ │ ├── TrustProxies.php
│ │ ├── LogLastUserActivity.php
│ │ └── RedirectIfAuthenticated.php
│ ├── Controllers
│ │ ├── Error
│ │ │ └── ErrorController.php
│ │ ├── HomeController.php
│ │ ├── Controller.php
│ │ ├── Auth
│ │ │ ├── ForgotPasswordController.php
│ │ │ ├── ResetPasswordController.php
│ │ │ ├── LoginController.php
│ │ │ └── RegisterController.php
│ │ ├── ConfigController.php
│ │ ├── Profile
│ │ │ └── ProfileController.php
│ │ └── User
│ │ │ ├── RoleController.php
│ │ │ └── UserController.php
│ └── Kernel.php
├── Models
│ ├── PermissionGroup.php
│ ├── Config.php
│ ├── Role.php
│ ├── Permission.php
│ └── User.php
├── Providers
│ ├── BroadcastServiceProvider.php
│ ├── AppServiceProvider.php
│ ├── EventServiceProvider.php
│ ├── AuthServiceProvider.php
│ └── RouteServiceProvider.php
├── Exceptions
│ └── Handler.php
└── Console
│ └── Kernel.php
├── tests
├── TestCase.php
├── Unit
│ └── ExampleTest.php
├── Feature
│ └── ExampleTest.php
└── CreatesApplication.php
├── .styleci.yml
├── .editorconfig
├── .gitignore
├── package.json
├── webpack.mix.js
├── routes
├── channels.php
├── api.php
├── console.php
└── web.php
├── server.php
├── config
├── cors.php
├── services.php
├── view.php
├── hashing.php
├── broadcasting.php
├── filesystems.php
├── queue.php
├── logging.php
├── cache.php
├── mail.php
├── auth.php
└── database.php
├── .env.example
├── README.md
├── phpunit.xml
├── artisan
└── composer.json
/resources/css/app.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite*
2 |
--------------------------------------------------------------------------------
/bootstrap/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/public/assets/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/resources/js/app.js:
--------------------------------------------------------------------------------
1 | require('./bootstrap');
2 |
--------------------------------------------------------------------------------
/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/testing/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/cache/data/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !data/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/VsCode.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mairorodrigues/Laravel-AdminLTE/HEAD/VsCode.exe
--------------------------------------------------------------------------------
/public/img/config/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mairorodrigues/Laravel-AdminLTE/HEAD/public/img/config/logo.png
--------------------------------------------------------------------------------
/public/img/config/nopic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mairorodrigues/Laravel-AdminLTE/HEAD/public/img/config/nopic.png
--------------------------------------------------------------------------------
/public/img/config/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mairorodrigues/Laravel-AdminLTE/HEAD/public/img/config/favicon.png
--------------------------------------------------------------------------------
/public/img/config/dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mairorodrigues/Laravel-AdminLTE/HEAD/public/img/config/dashboard.png
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 | *.js linguist-vendored
5 | CHANGELOG.md export-ignore
6 |
--------------------------------------------------------------------------------
/resources/views/errors/404.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors::minimal')
2 |
3 | @section('title', __('Not Found'))
4 | @section('code', '404')
5 | @section('message', __('Not Found'))
6 |
--------------------------------------------------------------------------------
/resources/views/errors/401.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors::minimal')
2 |
3 | @section('title', __('Unauthorized'))
4 | @section('code', '401')
5 | @section('message', __('Unauthorized'))
6 |
--------------------------------------------------------------------------------
/resources/views/errors/419.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors::minimal')
2 |
3 | @section('title', __('Page Expired'))
4 | @section('code', '419')
5 | @section('message', __('Page Expired'))
6 |
--------------------------------------------------------------------------------
/resources/views/errors/500.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors::minimal')
2 |
3 | @section('title', __('Server Error'))
4 | @section('code', '500')
5 | @section('message', __('Server Error'))
6 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | compiled.php
2 | config.php
3 | down
4 | events.scanned.php
5 | maintenance.php
6 | routes.php
7 | routes.scanned.php
8 | schedule-*
9 | services.json
10 |
--------------------------------------------------------------------------------
/resources/views/errors/429.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors::minimal')
2 |
3 | @section('title', __('Too Many Requests'))
4 | @section('code', '429')
5 | @section('message', __('Too Many Requests'))
6 |
--------------------------------------------------------------------------------
/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors::minimal')
2 |
3 | @section('title', __('Service Unavailable'))
4 | @section('code', '503')
5 | @section('message', __('Service Unavailable'))
6 |
--------------------------------------------------------------------------------
/app/Http/Requests/Request.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Models/PermissionGroup.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Models\Permission');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | middleware("auth");
14 | }
15 |
16 | public function unauthorized()
17 | {
18 | return view('errors.unauthorized');
19 | }
20 | }
--------------------------------------------------------------------------------
/app/Http/Requests/User/StoreRoleRequest.php:
--------------------------------------------------------------------------------
1 | get('/');
18 |
19 | $response->assertStatus(200);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrustHosts.php:
--------------------------------------------------------------------------------
1 | allSubdomainsOfApplicationUrl(),
18 | ];
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/Middleware/PreventRequestsDuringMaintenance.php:
--------------------------------------------------------------------------------
1 | 'required|string|min:4|max:255',
25 | ];
26 | }
27 | }
--------------------------------------------------------------------------------
/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
19 |
20 | return $app;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/Providers/BroadcastServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'required|string|min:6|confirmed',
25 | 'password_confirmation' => 'required|min:6'
26 | ];
27 | }
28 | }
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | expectsJson()) {
18 | return route('login');
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Requests/Profile/UpdatePasswordProfileRequest.php:
--------------------------------------------------------------------------------
1 | 'required|string|min:6|confirmed',
25 | 'password_confirmation' => 'required|min:6'
26 | ];
27 | }
28 | }
--------------------------------------------------------------------------------
/app/Http/Requests/User/UpdateUserRequest.php:
--------------------------------------------------------------------------------
1 | 'E-mail already registered in the system.',
18 | ];
19 | }
20 |
21 | public function rules()
22 | {
23 | return [
24 | 'name' => 'required|string|min:4|max:255',
25 | 'email' => 'required|email|unique:users,email,'.$this->id
26 | ];
27 | }
28 | }
--------------------------------------------------------------------------------
/app/Models/Role.php:
--------------------------------------------------------------------------------
1 | belongsToMany(Permission::class);
18 | }
19 |
20 | static function rolesUser($user)
21 | {
22 | $roles_ids = [];
23 |
24 | foreach ($user->roles as $role) {
25 | $roles_ids[] = $role->id;
26 | }
27 |
28 | return $roles_ids;
29 | }
30 | }
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
18 | }
19 |
20 | /**
21 | * Show the application dashboard.
22 | *
23 | * @return \Illuminate\Http\Response
24 | */
25 | public function index()
26 | {
27 | return view('home');
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/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 applications. By default, we are compiling the CSS
10 | | file for the application as well as bundling up all the JS files.
11 | |
12 | */
13 |
14 | mix.js('resources/js/app.js', 'public/js')
15 | .postCss('resources/css/app.css', 'public/css', [
16 | //
17 | ]);
18 |
--------------------------------------------------------------------------------
/app/Http/Requests/Profile/UpdateProfileRequest.php:
--------------------------------------------------------------------------------
1 | 'E-mail already registered in the system.',
18 | ];
19 | }
20 |
21 | public function rules()
22 | {
23 | return [
24 | 'name' => 'required|string|min:4|max:255',
25 | 'email' => 'required|email|unique:users,email,'.$this->id
26 | ];
27 | }
28 | }
--------------------------------------------------------------------------------
/resources/lang/pt_BR/pagination.php:
--------------------------------------------------------------------------------
1 | '« Anterior',
17 | 'next' => 'Próximo »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/routes/channels.php:
--------------------------------------------------------------------------------
1 | id === (int) $id;
18 | });
19 |
--------------------------------------------------------------------------------
/routes/api.php:
--------------------------------------------------------------------------------
1 | get('/user', function (Request $request) {
18 | return $request->user();
19 | });
20 |
--------------------------------------------------------------------------------
/server.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 |
--------------------------------------------------------------------------------
/routes/console.php:
--------------------------------------------------------------------------------
1 | comment(Inspiring::quote());
19 | })->purpose('Display an inspiring quote');
20 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Send Requests To Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrustProxies.php:
--------------------------------------------------------------------------------
1 | addMinutes(5);
23 | Cache::put('user-is-online-' . Auth::user()->id, true, $expiresAt);
24 | }
25 |
26 | return $next($request);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/Http/Requests/User/StoreUserRequest.php:
--------------------------------------------------------------------------------
1 | 'E-mail already registered in the system.',
18 | ];
19 | }
20 |
21 | public function rules()
22 | {
23 | return [
24 | 'name' => 'required|string|min:4|max:255',
25 | 'email' => 'required|string|email|max:255|unique:users',
26 | 'password' => 'required|string|min:6|confirmed',
27 | 'password_confirmation' => 'required|min:6'
28 | ];
29 | }
30 | }
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | middleware("auth");
17 | }
18 |
19 | public function flashMessage($icon, $message, $alert){
20 | \Session::flash('flash_message',[
21 | 'msg'=>" $message",
22 | 'class'=>"alert-$alert"
23 | ]);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/resources/lang/pt_BR/auth.php:
--------------------------------------------------------------------------------
1 | 'Usuário ou senha inválidos.',
17 | 'password' => 'A senha informada está incorreta.',
18 | 'throttle' => 'Muitas tentativas de login. Tente novamente em :seconds segundos.',
19 |
20 | ];
21 |
--------------------------------------------------------------------------------
/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'password' => 'The provided password is incorrect.',
18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
19 |
20 | ];
21 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
19 | SendEmailVerificationNotification::class,
20 | ],
21 | ];
22 |
23 | /**
24 | * Register any events for your application.
25 | *
26 | * @return void
27 | */
28 | public function boot()
29 | {
30 | //
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Your password has been reset!',
17 | 'sent' => 'We have emailed your password reset link!',
18 | 'throttled' => 'Please wait before retrying.',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that email address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/database/migrations/2023_10_04_171516_add_register_to_configs_table.php:
--------------------------------------------------------------------------------
1 | string('register')->default('T');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('configs', function (Blueprint $table) {
29 | $table->dropColumn('register');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
18 | $table->string('token');
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 |
--------------------------------------------------------------------------------
/database/migrations/2023_10_04_141357_add_default_role_id_to_configs_table.php:
--------------------------------------------------------------------------------
1 | string('default_role_id')->default('2');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('configs', function (Blueprint $table) {
29 | $table->dropColumn('default_role_id');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Http/Middleware/RedirectIfAuthenticated.php:
--------------------------------------------------------------------------------
1 | check()) {
26 | return redirect(RouteServiceProvider::HOME);
27 | }
28 | }
29 |
30 | return $next($request);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/resources/views/errors/403.blade.php:
--------------------------------------------------------------------------------
1 | @section('title', 'Unauthorized access')
2 |
3 |
4 |
5 |
6 |
7 | @include('layouts.AdminLTE._includes._head')
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
21 |
22 |
23 | @include('layouts.AdminLTE._includes._script_footer')
24 |
25 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | reportable(function (Throwable $e) {
38 | //
39 | });
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/resources/lang/pt_BR/passwords.php:
--------------------------------------------------------------------------------
1 | 'A senha e a confirmação devem combinar e possuir pelo menos seis caracteres.',
17 | 'reset' => 'Sua senha foi redefinida!',
18 | 'sent' => 'Enviamos seu link de redefinição de senha por e-mail!',
19 | 'throttled' => 'Aguarde antes de tentar novamente.',
20 | 'token' => 'Este token de redefinição de senha é inválido.',
21 | 'user' => "Não encontramos um usuário com esse endereço de e-mail.",
22 |
23 | ];
24 |
--------------------------------------------------------------------------------
/config/cors.php:
--------------------------------------------------------------------------------
1 | ['api/*', 'sanctum/csrf-cookie'],
19 |
20 | 'allowed_methods' => ['*'],
21 |
22 | 'allowed_origins' => ['*'],
23 |
24 | 'allowed_origins_patterns' => [],
25 |
26 | 'allowed_headers' => ['*'],
27 |
28 | 'exposed_headers' => [],
29 |
30 | 'max_age' => 0,
31 |
32 | 'supports_credentials' => false,
33 |
34 | ];
35 |
--------------------------------------------------------------------------------
/resources/js/bootstrap.js:
--------------------------------------------------------------------------------
1 | window._ = require('lodash');
2 |
3 | /**
4 | * We'll load the axios HTTP library which allows us to easily issue requests
5 | * to our Laravel back-end. This library automatically handles sending the
6 | * CSRF token as a header based on the value of the "XSRF" token cookie.
7 | */
8 |
9 | window.axios = require('axios');
10 |
11 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
12 |
13 | /**
14 | * Echo exposes an expressive API for subscribing to channels and listening
15 | * for events that are broadcast by Laravel. Echo and event broadcasting
16 | * allows your team to easily build robust real-time web applications.
17 | */
18 |
19 | // import Echo from 'laravel-echo';
20 |
21 | // window.Pusher = require('pusher-js');
22 |
23 | // window.Echo = new Echo({
24 | // broadcaster: 'pusher',
25 | // key: process.env.MIX_PUSHER_APP_KEY,
26 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
27 | // forceTLS: true
28 | // });
29 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/ForgotPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')->hourly();
28 | }
29 |
30 | /**
31 | * Register the commands for the application.
32 | *
33 | * @return void
34 | */
35 | protected function commands()
36 | {
37 | $this->load(__DIR__.'/Commands');
38 |
39 | require base_path('routes/console.php');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | APP_NAME=Laravel
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_URL=http://localhost
6 |
7 | LOG_CHANNEL=stack
8 | LOG_LEVEL=debug
9 |
10 | DB_CONNECTION=mysql
11 | DB_HOST=127.0.0.1
12 | DB_PORT=3306
13 | DB_DATABASE=laravel
14 | DB_USERNAME=root
15 | DB_PASSWORD=
16 |
17 | BROADCAST_DRIVER=log
18 | CACHE_DRIVER=file
19 | QUEUE_CONNECTION=sync
20 | SESSION_DRIVER=file
21 | SESSION_LIFETIME=120
22 |
23 | MEMCACHED_HOST=127.0.0.1
24 |
25 | REDIS_HOST=127.0.0.1
26 | REDIS_PASSWORD=null
27 | REDIS_PORT=6379
28 |
29 | MAIL_MAILER=smtp
30 | MAIL_HOST=mailhog
31 | MAIL_PORT=1025
32 | MAIL_USERNAME=null
33 | MAIL_PASSWORD=null
34 | MAIL_ENCRYPTION=null
35 | MAIL_FROM_ADDRESS=null
36 | MAIL_FROM_NAME="${APP_NAME}"
37 |
38 | AWS_ACCESS_KEY_ID=
39 | AWS_SECRET_ACCESS_KEY=
40 | AWS_DEFAULT_REGION=us-east-1
41 | AWS_BUCKET=
42 |
43 | PUSHER_APP_ID=
44 | PUSHER_APP_KEY=
45 | PUSHER_APP_SECRET=
46 | PUSHER_APP_CLUSTER=mt1
47 |
48 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
49 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
50 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
21 | ],
22 |
23 | 'postmark' => [
24 | 'token' => env('POSTMARK_TOKEN'),
25 | ],
26 |
27 | 'ses' => [
28 | 'key' => env('AWS_ACCESS_KEY_ID'),
29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
31 | ],
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/_includes/_footer.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | 'Sunday',
11 | 'Mon' => 'Monday',
12 | 'Tue' => 'Tuesday',
13 | 'Wed' => 'Wednesday',
14 | 'Thu' => 'Thursday',
15 | 'Fri' => 'Friday',
16 | 'Sat' => 'Saturday'
17 | );
18 |
19 | $mes_extenso = array(
20 | 'Jan' => 'January',
21 | 'Feb' => 'February',
22 | 'Mar' => 'March',
23 | 'Apr' => 'April',
24 | 'May' => 'May',
25 | 'Jun' => 'June',
26 | 'Jul' => 'July',
27 | 'Aug' => 'August',
28 | 'Nov' => 'November',
29 | 'Sep' => 'September',
30 | 'Oct' => 'October',
31 | 'Dec' => 'December'
32 | );
33 |
34 | echo "".$semana["$data"] . ", {$dia} de " . $mes_extenso["$mes"] . " de {$ano}. ";
35 | ?>
36 |
37 | Copyright © {!! \App\Models\Config::find(1)->app_name !!} .
38 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/ResetPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/Http/Requests/ConfigRequest.php:
--------------------------------------------------------------------------------
1 | 'Application name is required.',
23 | 'app_name.max'=>'Name must be up to 30 characters.',
24 | 'caminho_img_login.image'=>'Select an image.',
25 | 'favicon.image'=>'Select an image.',
26 | ];
27 | }
28 |
29 | /**
30 | * Get the validation rules that apply to the request.
31 | *
32 | * @return array
33 | */
34 | public function rules()
35 | {
36 | return [
37 | 'app_name'=>'required|max:30',
38 | 'caminho_img_login'=>'image|mimes:jpeg,png,jpg,gif,svg,ico|max:2048',
39 | 'favicon'=>'image|mimes:jpeg,png,jpg,gif,svg,ico|max:2048',
40 | ];
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | bigIncrements('id');
19 | $table->string('name');
20 | $table->string('email')->unique();
21 | $table->timestamp('email_verified_at')->nullable();
22 | $table->string('password');
23 | $table->string('avatar')->default('img/config/nopic.png');
24 | $table->boolean('active');
25 | $table->rememberToken();
26 | $table->timestamps();
27 | });
28 | }
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::dropIfExists('users');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
18 | ];
19 |
20 | /**
21 | * Register any authentication / authorization services.
22 | *
23 | * @return void
24 | */
25 | public function boot()
26 | {
27 | $this->registerPolicies();
28 |
29 | try {
30 | $permissions = Permission::with('roles')->get();
31 | } catch (\Exception $e) {
32 | return [];
33 | }
34 |
35 | foreach ($permissions as $permission) {
36 | Gate::define($permission->name, function ($user) use ($permission){
37 | return $user->hasPermission($permission);
38 | });
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | resource_path('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' => env(
32 | 'VIEW_COMPILED_PATH',
33 | realpath(storage_path('framework/views'))
34 | ),
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AdminLTE template Laravel 8 package
2 |
3 | Start a new Laravel 8 project with the AdminLTE template installed.
4 |
5 |
6 |
7 | # Installation
8 |
9 | 1) Create database.
10 | 2) Clone repository `git clone https://github.com/mairorodrigues/Laravel-AdminLTE.git`
11 | 3) Copy `.env.example` to `.env`
12 | 4) Set valid database credentials of env variables `DB_DATABASE`, `DB_USERNAME`, and `DB_PASSWORD`
13 | 5) Run `composer install`
14 | 6) Create symbolic link for AdminLTE (Run the commands as an administrator)
15 |
16 | - Windows example:
17 |
18 | ```php
19 | mklink /d "C:\xampp\htdocs\laravel-adminlte\public\assets\adminlte" "C:\xampp\htdocs\laravel-adminlte\vendor\almasaeed2010\adminlte"
20 | ```
21 |
22 | - Linux example:
23 |
24 | ```php
25 | ln -s public_html/laravel-adminlte/vendor/almasaeed2010/adminlte public_html/laravel-adminlte/public/assets/adminlte
26 | ```
27 | 7) Run
28 | ```php
29 | php artisan migrate
30 | ```
31 | ```php
32 | php artisan db:seed
33 | ```
34 | ```php
35 | php artisan key:generate
36 | ```
37 | ```php
38 | php artisan serve
39 | ```
40 | 8) Access the application. Example: `http://127.0.0.1:8000`
41 | 9) Login: `dev@dev.com` Password: `root`
42 |
--------------------------------------------------------------------------------
/database/seeders/ConfigTableSeeder.php:
--------------------------------------------------------------------------------
1 | 'App Name', // String
20 | 'app_name_abv' => 'AN', // String
21 | 'app_slogan' => 'App Slogan', // String
22 | 'captcha' => 'F', // 'T' or 'F'
23 | 'datasitekey' => '', //String
24 | 'recaptcha_secret' => '', //String
25 | 'img_login' => 'T', // 'T' or 'F'
26 | 'caminho_img_login' => 'img/config/logo.png', //String -> defaut: 'img/config/logo.png'
27 | 'tamanho_img_login' => '40', // Integer
28 | 'titulo_login' => 'App Name ', //String
29 | 'layout' => 'fixed', //String -> defaut: 'fixed'
30 | 'skin' => 'blue', //String -> defaut: 'blue'
31 | 'favicon' => 'img/config/favicon.png', //String
32 | 'default_role_id' => '2', //String
33 | 'register' => 'T', // 'T' or 'F'
34 | ]);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/public/web.config:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | ./tests/Unit
10 |
11 |
12 | ./tests/Feature
13 |
14 |
15 |
16 |
17 | ./app
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/database/migrations/2018_04_28_115529_create_roles_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name', 50);
19 | $table->string('label', 200);
20 | $table->timestamps();
21 | });
22 |
23 | Schema::create('role_user', function (Blueprint $table) {
24 | $table->increments('id');
25 | $table->integer('role_id')->unsigned();
26 | $table->unsignedBigInteger('user_id');
27 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
28 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
29 | });
30 | }
31 |
32 | /**
33 | * Reverse the migrations.
34 | *
35 | * @return void
36 | */
37 | public function down()
38 | {
39 | Schema::dropIfExists('role_user');
40 | Schema::dropIfExists('roles');
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/Models/Permission.php:
--------------------------------------------------------------------------------
1 | belongsToMany(Role::class);
18 | }
19 |
20 | static function permissionsRole($role)
21 | {
22 | $permissions_ids = [];
23 |
24 | foreach ($role->permissions as $permission) {
25 | $permissions_ids[] = $permission->id;
26 | }
27 |
28 | return $permissions_ids;
29 | }
30 |
31 | static function permissionsId($var)
32 | {
33 | $permissions_ids = [];
34 |
35 | foreach (Permission::all() as $permission) {
36 | if($var == 1){
37 | $permissions_ids[] = $permission->id;
38 | }
39 | if($var == 2){
40 | if($permission->id > 1){
41 | $permissions_ids[] = $permission->id;
42 | }
43 | }
44 | }
45 |
46 | return $permissions_ids;
47 | }
48 |
49 | public function permissionGroup()
50 | {
51 | return $this->belongsTo(PermissionGroup::class, 'permission_group_id');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/database/seeders/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | command->info('Initializing...');
23 | $this->command->info('Deleting tables...');
24 |
25 | DB::table('configs')->truncate();
26 | DB::table('role_user')->truncate();
27 | DB::table('permission_role')->truncate();
28 | DB::table('permissions')->truncate();
29 | DB::table('permission_groups')->truncate();
30 | DB::table('roles')->truncate();
31 | DB::table('users')->truncate();
32 |
33 | $this->command->info('Deleted tables!');
34 | $this->command->info('Creating Tables...');
35 |
36 | $this->call([
37 | ConfigTableSeeder::class,
38 | PermissionRoleTablesSeeder::class,
39 | RoleUserTablesSeeder::class,
40 | ]);
41 |
42 | $this->command->info('Finished!');
43 |
44 | DB::statement('SET FOREIGN_KEY_CHECKS=1;');
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/database/factories/UserFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->name(),
27 | 'email' => $this->faker->unique()->safeEmail(),
28 | 'email_verified_at' => now(),
29 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
30 | 'remember_token' => Str::random(10),
31 | 'active' => 1,
32 | 'avatar' => 'img/config/nopic.png'
33 | ];
34 | }
35 |
36 | /**
37 | * Indicate that the model's email address should be unverified.
38 | *
39 | * @return \Illuminate\Database\Eloquent\Factories\Factory
40 | */
41 | public function unverified()
42 | {
43 | return $this->state(function (array $attributes) {
44 | return [
45 | 'email_verified_at' => null,
46 | ];
47 | });
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/database/migrations/2018_04_09_172746_create_configs_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | //Config App
19 | $table->string('app_name');
20 | $table->string('app_name_abv');
21 | $table->string('app_slogan')->nullable();
22 | //Config Captcha
23 | $table->string('captcha');
24 | $table->string('datasitekey')->nullable();
25 | $table->string('recaptcha_secret')->nullable();
26 | //Config Login
27 | $table->string('img_login');
28 | $table->string('caminho_img_login')->nullable();
29 | $table->integer('tamanho_img_login')->nullable();
30 | $table->string('titulo_login');
31 | //Config Layout
32 | $table->string('layout');
33 | $table->string('skin');
34 | $table->string('favicon')->nullable();
35 | $table->timestamps();
36 | });
37 | }
38 |
39 | /**
40 | * Reverse the migrations.
41 | *
42 | * @return void
43 | */
44 | public function down()
45 | {
46 | Schema::dropIfExists('configs');
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/database/seeders/RoleUserTablesSeeder.php:
--------------------------------------------------------------------------------
1 | createAdmins();
20 |
21 | // Vincula usuários aos papéis
22 | $this->sync();
23 | }
24 |
25 | private function createAdmins()
26 | {
27 | User::create([
28 | 'email' => 'dev@dev.com',
29 | 'name' => 'Developer',
30 | 'password' => bcrypt('root'),
31 | 'avatar' => 'img/config/nopic.png',
32 | 'active' => true
33 | ]);
34 |
35 | $this->command->info('User dev created');
36 |
37 | User::create([
38 | 'email' => 'admin@admin.com',
39 | 'name' => 'Administrator',
40 | 'password' => bcrypt('admin'),
41 | 'avatar' => 'img/config/nopic.png',
42 | 'active' => true
43 | ]);
44 |
45 | $this->command->info('Users dev and admin created');
46 | }
47 |
48 | private function sync()
49 | {
50 | $role = User::find(1);
51 | $role->roles()->sync([1]);
52 |
53 | $role = User::find(2);
54 | $role->roles()->sync([2]);
55 |
56 | $this->command->info('Users linked to roles!');
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/Models/User.php:
--------------------------------------------------------------------------------
1 | can('root-dev', '');
43 | }
44 |
45 | public function roles()
46 | {
47 | return $this->belongsToMany(Role::class);
48 | }
49 |
50 | public function hasPermission(Permission $permission)
51 | {
52 | return $this->hasAnyRoles($permission->roles);
53 | }
54 |
55 | public function hasAnyRoles($roles)
56 | {
57 | if(is_array($roles) || is_object($roles) ) {
58 | return !! $roles->intersect($this->roles)->count();
59 | }
60 |
61 | return $this->roles->contains('name', $roles);
62 | }
63 |
64 | public function isOnline()
65 | {
66 | return Cache::has('user-is-online-' . $this->id);
67 | }
68 |
69 | }
--------------------------------------------------------------------------------
/resources/views/errors/layout.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | @yield('title')
8 |
9 |
10 |
11 |
12 |
13 |
14 |
47 |
48 |
49 |
50 |
51 |
52 | @yield('message')
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/config/hashing.php:
--------------------------------------------------------------------------------
1 | 'bcrypt',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Bcrypt Options
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may specify the configuration options that should be used when
26 | | passwords are hashed using the Bcrypt algorithm. This will allow you
27 | | to control the amount of time it takes to hash the given password.
28 | |
29 | */
30 |
31 | 'bcrypt' => [
32 | 'rounds' => env('BCRYPT_ROUNDS', 10),
33 | ],
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Argon Options
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here you may specify the configuration options that should be used when
41 | | passwords are hashed using the Argon algorithm. These will allow you
42 | | to control the amount of time it takes to hash the given password.
43 | |
44 | */
45 |
46 | 'argon' => [
47 | 'memory' => 1024,
48 | 'threads' => 2,
49 | 'time' => 2,
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/database/migrations/2018_04_28_115600_create_permissions_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name', 50);
19 | $table->timestamps();
20 | });
21 |
22 | Schema::create('permissions', function (Blueprint $table) {
23 | $table->increments('id');
24 | $table->integer('permission_group_id')->unsigned();
25 | $table->foreign('permission_group_id')->references('id')->on('permission_groups')->onDelete('cascade');
26 | $table->string('name', 50);
27 | $table->string('label', 200);
28 | $table->timestamps();
29 | });
30 |
31 | Schema::create('permission_role', function (Blueprint $table) {
32 | $table->increments('id');
33 | $table->integer('permission_id')->unsigned();
34 | $table->integer('role_id')->unsigned();
35 | $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
36 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
37 | });
38 | }
39 |
40 | /**
41 | * Reverse the migrations.
42 | *
43 | * @return void
44 | */
45 | public function down()
46 | {
47 | Schema::dropIfExists('permission_role');
48 | Schema::dropIfExists('permissions');
49 | Schema::dropIfExists('permission_groups');
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
34 |
35 | $status = $kernel->handle(
36 | $input = new Symfony\Component\Console\Input\ArgvInput,
37 | new Symfony\Component\Console\Output\ConsoleOutput
38 | );
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Shutdown The Application
43 | |--------------------------------------------------------------------------
44 | |
45 | | Once Artisan has finished running, we will fire off the shutdown events
46 | | so that any final work may be done by the application before we shut
47 | | down the process. This is the last thing to happen to the request.
48 | |
49 | */
50 |
51 | $kernel->terminate($input, $status);
52 |
53 | exit($status);
54 |
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class);
50 |
51 | $response = tap($kernel->handle(
52 | $request = Request::capture()
53 | ))->send();
54 |
55 | $kernel->terminate($request, $response);
56 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | configureRateLimiting();
39 |
40 | $this->routes(function () {
41 | Route::prefix('api')
42 | ->middleware('api')
43 | ->namespace($this->namespace)
44 | ->group(base_path('routes/api.php'));
45 |
46 | Route::middleware('web')
47 | ->namespace($this->namespace)
48 | ->group(base_path('routes/web.php'));
49 | });
50 | }
51 |
52 | /**
53 | * Configure the rate limiters for the application.
54 | *
55 | * @return void
56 | */
57 | protected function configureRateLimiting()
58 | {
59 | RateLimiter::for('api', function (Request $request) {
60 | return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
61 | });
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/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 | 'cluster' => env('PUSHER_APP_CLUSTER'),
40 | 'useTLS' => true,
41 | ],
42 | ],
43 |
44 | 'ably' => [
45 | 'driver' => 'ably',
46 | 'key' => env('ABLY_KEY'),
47 | ],
48 |
49 | 'redis' => [
50 | 'driver' => 'redis',
51 | 'connection' => 'default',
52 | ],
53 |
54 | 'log' => [
55 | 'driver' => 'log',
56 | ],
57 |
58 | 'null' => [
59 | 'driver' => 'null',
60 | ],
61 |
62 | ],
63 |
64 | ];
65 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/_includes/_menu_lateral.blade.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/LoginController.php:
--------------------------------------------------------------------------------
1 | middleware('guest')->except('logout');
40 | }
41 |
42 | protected function credentials(Request $request) {
43 | return ['email' => $request->{$this->username()}, 'password' => $request->password, 'active' => 1];
44 | }
45 |
46 | protected function sendFailedLoginResponse(Request $request)
47 | {
48 | $errors = [$this->username() => trans('auth.failed')];
49 |
50 | $user = User::where($this->username(), $request->{$this->username()})->first();
51 |
52 | if ($user && \Hash::check($request->password, $user->password) && $user->active != 1) {
53 | $errors = [$this->username() => trans('auth.notactivated')];
54 | }
55 |
56 | if ($request->expectsJson()) {
57 | return response()->json($errors, 422);
58 | }
59 | return redirect()->back()
60 | ->withInput($request->only($this->username(), 'remember'))
61 | ->withErrors($errors);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "laravel/laravel",
3 | "type": "project",
4 | "description": "The Laravel Framework.",
5 | "keywords": ["framework", "laravel"],
6 | "license": "MIT",
7 | "require": {
8 | "php": "^7.3|^8.0",
9 | "almasaeed2010/adminlte": "~2.4",
10 | "fideloper/proxy": "^4.4",
11 | "fruitcake/laravel-cors": "^2.0",
12 | "guzzlehttp/guzzle": "^7.0.1",
13 | "lab404/laravel-impersonate": "^1.7",
14 | "laravel/framework": "^8.12",
15 | "laravel/tinker": "^2.5",
16 | "laravel/ui": "^3.2"
17 | },
18 | "require-dev": {
19 | "facade/ignition": "^2.5",
20 | "fakerphp/faker": "^1.9.1",
21 | "laravel/sail": "^1.0.1",
22 | "lucascudo/laravel-pt-br-localization": "^1.1",
23 | "mockery/mockery": "^1.4.2",
24 | "nunomaduro/collision": "^5.0",
25 | "phpunit/phpunit": "^9.3.3"
26 | },
27 | "autoload": {
28 | "psr-4": {
29 | "App\\": "app/",
30 | "Database\\Factories\\": "database/factories/",
31 | "Database\\Seeders\\": "database/seeders/"
32 | }
33 | },
34 | "autoload-dev": {
35 | "psr-4": {
36 | "Tests\\": "tests/"
37 | }
38 | },
39 | "scripts": {
40 | "post-autoload-dump": [
41 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
42 | "@php artisan package:discover --ansi"
43 | ],
44 | "post-root-package-install": [
45 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
46 | ],
47 | "post-create-project-cmd": [
48 | "@php artisan key:generate --ansi"
49 | ]
50 | },
51 | "extra": {
52 | "laravel": {
53 | "dont-discover": []
54 | }
55 | },
56 | "config": {
57 | "optimize-autoloader": true,
58 | "preferred-install": "dist",
59 | "sort-packages": true,
60 | "allow-plugins": {
61 | "composer/installers": true
62 | }
63 | },
64 | "minimum-stability": "dev",
65 | "prefer-stable": true
66 | }
67 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | env('FILESYSTEM_DRIVER', 'local'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Filesystem Disks
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure as many filesystem "disks" as you wish, and you
24 | | may even configure multiple disks of the same driver. Defaults have
25 | | been setup for each driver as an example of the required options.
26 | |
27 | | Supported Drivers: "local", "ftp", "sftp", "s3"
28 | |
29 | */
30 |
31 | 'disks' => [
32 |
33 | 'local' => [
34 | 'driver' => 'local',
35 | 'root' => storage_path('app'),
36 | ],
37 |
38 | 'public' => [
39 | 'driver' => 'local',
40 | 'root' => storage_path('app/public'),
41 | 'url' => env('APP_URL').'/storage',
42 | 'visibility' => 'public',
43 | ],
44 |
45 | 's3' => [
46 | 'driver' => 's3',
47 | 'key' => env('AWS_ACCESS_KEY_ID'),
48 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
49 | 'region' => env('AWS_DEFAULT_REGION'),
50 | 'bucket' => env('AWS_BUCKET'),
51 | 'url' => env('AWS_URL'),
52 | 'endpoint' => env('AWS_ENDPOINT'),
53 | ],
54 |
55 | ],
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Symbolic Links
60 | |--------------------------------------------------------------------------
61 | |
62 | | Here you may configure the symbolic links that will be created when the
63 | | `storage:link` Artisan command is executed. The array keys should be
64 | | the locations of the links and the values should be their targets.
65 | |
66 | */
67 |
68 | 'links' => [
69 | public_path('storage') => storage_path('app/public'),
70 | ],
71 |
72 | ];
73 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/RegisterController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
42 | }
43 |
44 | /**
45 | * Get a validator for an incoming registration request.
46 | *
47 | * @param array $data
48 | * @return \Illuminate\Contracts\Validation\Validator
49 | */
50 | protected function validator(array $data)
51 | {
52 | return Validator::make($data, [
53 | 'name' => 'required|string|max:255|min:3',
54 | 'email' => 'required|string|email|max:255|unique:users',
55 | 'password' => 'required|string|min:8|confirmed',
56 | ]);
57 | }
58 |
59 | /**
60 | * Create a new user instance after a valid registration.
61 | *
62 | * @param array $data
63 | * @return \App\User
64 | */
65 | protected function create(array $data)
66 | {
67 | $user = User::create([
68 | 'active' => 1,
69 | 'avatar' => 'img/config/nopic.png',
70 | 'name' => $data['name'],
71 | 'email' => $data['email'],
72 | 'password' => Hash::make($data['password']),
73 | ]);
74 |
75 | $configs = Config::find(1);
76 |
77 | $user->roles()->sync($configs->default_role_id); // role id for those who register in the system
78 |
79 | return $user;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/_includes/_menu_superior.blade.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/_includes/_data_tables.blade.php:
--------------------------------------------------------------------------------
1 | @section('layout_css')
2 |
3 |
4 |
5 |
6 | @endsection
7 |
8 | @section('layout_js')
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
57 | @yield('in_data_table')
58 | @endsection
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | [
33 | \App\Http\Middleware\EncryptCookies::class,
34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
35 | \Illuminate\Session\Middleware\StartSession::class,
36 | // \Illuminate\Session\Middleware\AuthenticateSession::class,
37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
38 | \App\Http\Middleware\VerifyCsrfToken::class,
39 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
40 | \App\Http\Middleware\LogLastUserActivity::class,
41 | ],
42 |
43 | 'api' => [
44 | 'throttle:api',
45 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
46 | ],
47 | ];
48 |
49 | /**
50 | * The application's route middleware.
51 | *
52 | * These middleware may be assigned to groups or used individually.
53 | *
54 | * @var array
55 | */
56 | protected $routeMiddleware = [
57 | 'auth' => \App\Http\Middleware\Authenticate::class,
58 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class,
61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
63 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
66 | ];
67 | }
68 |
--------------------------------------------------------------------------------
/resources/views/auth/passwords/email.blade.php:
--------------------------------------------------------------------------------
1 | @section('title', 'Reset Password')
2 | @section('layout_css')
3 |
9 | @stop
10 |
11 |
12 |
13 |
14 |
15 | @include('layouts.AdminLTE._includes._head')
16 |
17 |
18 |
19 |
20 |
21 |
22 | @if(\App\Models\Config::find(1)->img_login == 'T')
23 |
24 |
25 | @endif
26 |
27 | {!! \App\Models\Config::find(1)->titulo_login !!}
28 |
29 |
30 | @if (session('status'))
31 |
32 | {{ session('status') }}
33 |
34 | @endif
35 |
59 |
60 |
61 |
62 | @include('layouts.AdminLTE._includes._script_footer')
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/_includes/_script_footer.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
47 |
48 |
49 |
50 | @yield('layout_js')
--------------------------------------------------------------------------------
/routes/web.php:
--------------------------------------------------------------------------------
1 | name('home');
12 | Route::get('/config', 'App\Http\Controllers\ConfigController@index')->name('config');
13 | Route::put('/config/update/{id}', 'App\Http\Controllers\ConfigController@update')->name('config.update');
14 | Route::post('/config/store/permission_group', 'App\Http\Controllers\ConfigController@storePermissionGroup')->name('config.store.permission_group');
15 | Route::put('/config/update/permission_group/{id}', 'App\Http\Controllers\ConfigController@updatePermissionGroup')->name('config.update.permission_group');
16 | Route::post('/config/store/permission', 'App\Http\Controllers\ConfigController@storePermission')->name('config.store.permission');
17 | Route::put('/config/update/permission/{id}', 'App\Http\Controllers\ConfigController@updatePermission')->name('config.update.permission');
18 |
19 | Route::group(['namespace' => 'App\Http\Controllers\Profile'], function (){
20 | Route::get('/profile', 'ProfileController@index')->name('profile');
21 | Route::put('/profile/update/profile/{id}', 'ProfileController@updateProfile')->name('profile.update.profile');
22 | Route::put('/profile/update/password/{id}', 'ProfileController@updatePassword')->name('profile.update.password');
23 | Route::put('/profile/update/avatar/{id}', 'ProfileController@updateAvatar')->name('profile.update.avatar');
24 | });
25 |
26 | Route::group(['namespace' => 'App\Http\Controllers\Error'], function (){
27 | Route::get('/unauthorized', 'ErrorController@unauthorized')->name('unauthorized');
28 | });
29 |
30 | Route::group(['namespace' => 'App\Http\Controllers\User'], function (){
31 | //Users
32 | Route::get('/user', 'UserController@index')->name('user');
33 | Route::get('/user/create', 'UserController@create')->name('user.create');
34 | Route::post('/user/store', 'UserController@store')->name('user.store');
35 | Route::get('/user/edit/{id}', 'UserController@edit')->name('user.edit');
36 | Route::put('/user/update/{id}', 'UserController@update')->name('user.update');
37 | Route::get('/user/edit/password/{id}', 'UserController@editPassword')->name('user.edit.password');
38 | Route::put('/user/update/password/{id}', 'UserController@updatePassword')->name('user.update.password');
39 | Route::get('/user/show/{id}', 'UserController@show')->name('user.show');
40 | Route::get('/user/destroy/{id}', 'UserController@destroy')->name('user.destroy');
41 | // Roles
42 | Route::get('/role', 'RoleController@index')->name('role');
43 | Route::get('/role/create', 'RoleController@create')->name('role.create');
44 | Route::post('/role/store', 'RoleController@store')->name('role.store');
45 | Route::get('/role/edit/{id}', 'RoleController@edit')->name('role.edit');
46 | Route::put('/role/update/{id}', 'RoleController@update')->name('role.update');
47 | Route::get('/role/show/{id}', 'RoleController@show')->name('role.show');
48 | Route::get('/role/destroy/{id}', 'RoleController@destroy')->name('role.destroy');
49 | });
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_CONNECTION', 'sync'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Queue Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure the connection information for each server that
24 | | is used by your application. A default configuration has been added
25 | | for each back-end shipped with Laravel. You are free to add more.
26 | |
27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
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 | 'after_commit' => false,
43 | ],
44 |
45 | 'beanstalkd' => [
46 | 'driver' => 'beanstalkd',
47 | 'host' => 'localhost',
48 | 'queue' => 'default',
49 | 'retry_after' => 90,
50 | 'block_for' => 0,
51 | 'after_commit' => false,
52 | ],
53 |
54 | 'sqs' => [
55 | 'driver' => 'sqs',
56 | 'key' => env('AWS_ACCESS_KEY_ID'),
57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
59 | 'queue' => env('SQS_QUEUE', 'default'),
60 | 'suffix' => env('SQS_SUFFIX'),
61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
62 | 'after_commit' => false,
63 | ],
64 |
65 | 'redis' => [
66 | 'driver' => 'redis',
67 | 'connection' => 'default',
68 | 'queue' => env('REDIS_QUEUE', 'default'),
69 | 'retry_after' => 90,
70 | 'block_for' => null,
71 | 'after_commit' => false,
72 | ],
73 |
74 | ],
75 |
76 | /*
77 | |--------------------------------------------------------------------------
78 | | Failed Queue Jobs
79 | |--------------------------------------------------------------------------
80 | |
81 | | These options configure the behavior of failed queue job logging so you
82 | | can control which database and table are used to store the jobs that
83 | | have failed. You may change them to any database / table you wish.
84 | |
85 | */
86 |
87 | 'failed' => [
88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
89 | 'database' => env('DB_CONNECTION', 'mysql'),
90 | 'table' => 'failed_jobs',
91 | ],
92 |
93 | ];
94 |
--------------------------------------------------------------------------------
/resources/views/users/edit_password.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'pencil')
4 |
5 | @section('title', 'Edit User Password')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 | @endsection
16 |
17 | @section('content')
18 | @if ($user->id != 1)
19 |
62 | @endif
63 | @endsection
--------------------------------------------------------------------------------
/app/Http/Controllers/ConfigController.php:
--------------------------------------------------------------------------------
1 | authorize('root-dev', $config);
22 |
23 | $roles = Role::all();
24 |
25 | $permission_groups = PermissionGroup::paginate(15);
26 |
27 | $permissions = Permission::paginate(15);
28 |
29 | return view('config.index',compact('config', 'permission_groups', 'permissions', 'roles'));
30 | }
31 |
32 | public function update(ConfigRequest $request, $id)
33 | {
34 | $this->authorize('root-dev', Config::class);
35 |
36 | Config::find($id)->update($request->all());
37 |
38 | if($request->file('caminho_img_login')){
39 | $file = $request->file('caminho_img_login');
40 | $ext = $file->guessClientExtension();
41 | $path = $file->move("img/config", "logo.{$ext}");
42 | Config::where('id', 1)->update(['caminho_img_login' => "img/config/logo.{$ext}"]);
43 | }
44 |
45 | if($request->file('favicon')){
46 | $file = $request->file('favicon');
47 | $ext = $file->guessClientExtension();
48 | $path = $file->move("img/config", "favicon.{$ext}");
49 | Config::where('id', 1)->update(['favicon' => "img/config/favicon.{$ext}"]);
50 | }
51 |
52 | $this->flashMessage('check', 'Application settings updated successfully!', 'success');
53 |
54 | return redirect()->route('config');
55 | }
56 |
57 | public function storePermissionGroup(Request $request)
58 | {
59 | $this->authorize('root-dev', Config::class);
60 |
61 | $permission_group = PermissionGroup::create($request->all());
62 |
63 | $this->flashMessage('check', 'Permission Group successfully added!', 'success');
64 |
65 | return redirect()->route('config');
66 | }
67 |
68 | public function updatePermissionGroup(Request $request, $id)
69 | {
70 | $this->authorize('root-dev', Config::class);
71 |
72 | PermissionGroup::find($id)->update($request->all());
73 |
74 | $this->flashMessage('check', 'Permission Group updated successfully!', 'success');
75 |
76 | return redirect()->route('config');
77 | }
78 |
79 | public function storePermission(Request $request)
80 | {
81 | $this->authorize('root-dev', Config::class);
82 |
83 | $permission = Permission::create($request->all());
84 |
85 | $this->flashMessage('check', 'Permission successfully added!', 'success');
86 |
87 | return redirect()->route('config');
88 | }
89 |
90 | public function updatePermission(Request $request, $id)
91 | {
92 | $this->authorize('root-dev', Config::class);
93 |
94 | Permission::find($id)->update($request->all());
95 |
96 | $this->flashMessage('check', 'Permission updated successfully!', 'success');
97 |
98 | return redirect()->route('config');
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/resources/views/users/show.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'eye')
4 |
5 | @section('title', 'View User')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 | @endsection
16 |
17 | @section('content')
18 | @if ($user->id != 1)
19 |
20 |
21 |
22 |
23 |
24 |
25 | @if(file_exists($user->avatar))
26 |
27 | @else
28 |
29 | @endif
30 |
31 | {{ $user->name }}
32 |
33 | @if($user->active == true)
34 |
Active
35 | @else
36 |
Inactive
37 | @endif
38 |
39 |
40 |
41 |
E-mail:
42 |
{{ $user->email }}
43 |
Permission Group
44 | @foreach($roles as $role)
45 | @if(in_array($role->id, $roles_ids))
46 |
{{ $role->name }}
47 | @endif
48 | @endforeach
49 |
50 |
Created on: {{$user->created_at->format('d/m/Y H:i') }}
51 |
Last update: {{$user->updated_at->format('d/m/Y H:i') }}
52 |
53 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | @endif
64 | @endsection
--------------------------------------------------------------------------------
/resources/views/users/roles/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'unlock-alt')
4 |
5 | @section('title', 'Permissions')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 |
18 |
19 |
20 | @endsection
21 |
22 | @section('content')
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Name
33 | Description
34 | Created
35 | Actions
36 |
37 |
38 |
39 | @foreach($roles as $role)
40 | @if($role->id != 1)
41 |
42 | {{ $role->name }}
43 | {{ $role->label }}
44 | {{ $role->created_at->format('d/m/Y H:i') }}
45 |
46 | name }}">
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
60 |
61 |
Do you really want to delete ({{ $role->name }}) ?
62 |
63 |
67 |
68 |
69 |
70 | @endif
71 | @endforeach
72 |
73 |
74 |
75 | Name
76 | Description
77 | Created
78 | Actions
79 |
80 |
81 |
82 |
83 |
84 |
85 | {{ $roles->links() }}
86 |
87 |
88 |
89 |
90 |
91 | @endsection
--------------------------------------------------------------------------------
/app/Http/Controllers/Profile/ProfileController.php:
--------------------------------------------------------------------------------
1 | middleware("auth");
20 | }
21 |
22 | public function index()
23 | {
24 | $user = Auth::user();
25 |
26 | $roles = Role::all();
27 |
28 | $roles_ids = Role::rolesUser($user);
29 |
30 | return view('profile.index',compact('user', 'roles', 'roles_ids'));
31 | }
32 |
33 | public function updateProfile(UpdateProfileRequest $request,$id)
34 | {
35 | $user = User::find($id);
36 |
37 | if(!$user){
38 | $this->flashMessage('warning', 'User not found!', 'danger');
39 | return redirect()->route('user');
40 | }
41 |
42 | if($user != Auth::user()){
43 | $this->flashMessage('warning', 'Error updating profile!', 'danger');
44 | return redirect()->route('profile');
45 | }
46 |
47 | $user->update($request->all());
48 |
49 | $this->flashMessage('check', 'Profile updated successfully!', 'success');
50 |
51 | return redirect()->route('profile');
52 | }
53 |
54 | public function updatePassword(UpdatePasswordProfileRequest $request,$id)
55 | {
56 | $user = User::find($id);
57 |
58 | if(!$user){
59 | $this->flashMessage('warning', 'User not found!', 'danger');
60 | return redirect()->route('user');
61 | }
62 |
63 | if($user != Auth::user()){
64 | $this->flashMessage('warning', 'Error updating password!', 'danger');
65 | return redirect()->route('profile');
66 | }
67 |
68 | $request->merge(['password' => bcrypt($request->get('password'))]);
69 |
70 | $user->update($request->all());
71 |
72 | $this->flashMessage('check', 'Password updated successfully!', 'success');
73 |
74 | return redirect()->route('profile');
75 | }
76 |
77 | public function updateAvatar(UpdateAvatarProfileRequest $request,$id)
78 | {
79 | $user = User::find($id);
80 |
81 | if(!$user){
82 | $this->flashMessage('warning', 'User not found!', 'danger');
83 | return redirect()->route('user');
84 | }
85 |
86 | if($user != Auth::user()){
87 | $this->flashMessage('warning', 'Error updating avatar!', 'danger');
88 | return redirect()->route('profile');
89 | }
90 |
91 | $request->validate([
92 | 'avatar' => 'required|image|mimes:jpeg,png,jpg,gif,svg,ico|max:2048',
93 | ]);
94 |
95 | if($request->file('avatar')){
96 | $file = $request->file('avatar');
97 | $ext = $file->guessClientExtension();
98 | $path = $file->move("profiles/$id", "avatar.{$ext}");
99 | User::where('id', $id)->update(['avatar' => "profiles/$id/avatar.{$ext}"]);
100 | }
101 |
102 | $this->flashMessage('check', 'Avatar updated successfully!', 'success');
103 |
104 | return redirect()->route('profile');
105 | }
106 | }
--------------------------------------------------------------------------------
/config/logging.php:
--------------------------------------------------------------------------------
1 | env('LOG_CHANNEL', 'stack'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Log Channels
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here you may configure the log channels for your application. Out of
28 | | the box, Laravel uses the Monolog PHP logging library. This gives
29 | | you a variety of powerful log handlers / formatters to utilize.
30 | |
31 | | Available Drivers: "single", "daily", "slack", "syslog",
32 | | "errorlog", "monolog",
33 | | "custom", "stack"
34 | |
35 | */
36 |
37 | 'channels' => [
38 | 'stack' => [
39 | 'driver' => 'stack',
40 | 'channels' => ['single'],
41 | 'ignore_exceptions' => false,
42 | ],
43 |
44 | 'single' => [
45 | 'driver' => 'single',
46 | 'path' => storage_path('logs/laravel.log'),
47 | 'level' => env('LOG_LEVEL', 'debug'),
48 | ],
49 |
50 | 'daily' => [
51 | 'driver' => 'daily',
52 | 'path' => storage_path('logs/laravel.log'),
53 | 'level' => env('LOG_LEVEL', 'debug'),
54 | 'days' => 14,
55 | ],
56 |
57 | 'slack' => [
58 | 'driver' => 'slack',
59 | 'url' => env('LOG_SLACK_WEBHOOK_URL'),
60 | 'username' => 'Laravel Log',
61 | 'emoji' => ':boom:',
62 | 'level' => env('LOG_LEVEL', 'critical'),
63 | ],
64 |
65 | 'papertrail' => [
66 | 'driver' => 'monolog',
67 | 'level' => env('LOG_LEVEL', 'debug'),
68 | 'handler' => SyslogUdpHandler::class,
69 | 'handler_with' => [
70 | 'host' => env('PAPERTRAIL_URL'),
71 | 'port' => env('PAPERTRAIL_PORT'),
72 | ],
73 | ],
74 |
75 | 'stderr' => [
76 | 'driver' => 'monolog',
77 | 'level' => env('LOG_LEVEL', 'debug'),
78 | 'handler' => StreamHandler::class,
79 | 'formatter' => env('LOG_STDERR_FORMATTER'),
80 | 'with' => [
81 | 'stream' => 'php://stderr',
82 | ],
83 | ],
84 |
85 | 'syslog' => [
86 | 'driver' => 'syslog',
87 | 'level' => env('LOG_LEVEL', 'debug'),
88 | ],
89 |
90 | 'errorlog' => [
91 | 'driver' => 'errorlog',
92 | 'level' => env('LOG_LEVEL', 'debug'),
93 | ],
94 |
95 | 'null' => [
96 | 'driver' => 'monolog',
97 | 'handler' => NullHandler::class,
98 | ],
99 |
100 | 'emergency' => [
101 | 'path' => storage_path('logs/laravel.log'),
102 | ],
103 | ],
104 |
105 | ];
106 |
--------------------------------------------------------------------------------
/resources/views/users/roles/show.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'eye')
4 |
5 | @section('title', 'View Permission')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 | @endsection
16 |
17 | @section('content')
18 | @if($role->id != 1)
19 |
20 |
21 |
22 |
23 |
Name: {{ $role->name }}
24 |
Description: {{ $role->label }}
25 |
Permissions:
26 | @foreach($permission_groups as $permission_group)
27 |
28 |
35 |
36 |
37 | @foreach($permission_group->permissions as $permission)
38 |
39 | id, $permissions_ids))
41 | checked
42 | @endif
43 | disabled> {{ $permission->label }}
44 |
45 | @endforeach
46 |
47 |
48 |
49 | @endforeach
50 |
Created on: {{$role->created_at->format('d/m/Y H:i') }}
51 |
Last update: {{$role->updated_at->format('d/m/Y H:i') }}
52 |
55 |
56 |
57 |
58 |
59 | @endif
60 |
61 | @endsection
62 |
63 | @section('layout_js')
64 |
65 |
74 |
75 | @endsection
--------------------------------------------------------------------------------
/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 | | Supported drivers: "apc", "array", "database", "file",
30 | | "memcached", "redis", "dynamodb", "null"
31 | |
32 | */
33 |
34 | 'stores' => [
35 |
36 | 'apc' => [
37 | 'driver' => 'apc',
38 | ],
39 |
40 | 'array' => [
41 | 'driver' => 'array',
42 | 'serialize' => false,
43 | ],
44 |
45 | 'database' => [
46 | 'driver' => 'database',
47 | 'table' => 'cache',
48 | 'connection' => null,
49 | 'lock_connection' => null,
50 | ],
51 |
52 | 'file' => [
53 | 'driver' => 'file',
54 | 'path' => storage_path('framework/cache/data'),
55 | ],
56 |
57 | 'memcached' => [
58 | 'driver' => 'memcached',
59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
60 | 'sasl' => [
61 | env('MEMCACHED_USERNAME'),
62 | env('MEMCACHED_PASSWORD'),
63 | ],
64 | 'options' => [
65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000,
66 | ],
67 | 'servers' => [
68 | [
69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
70 | 'port' => env('MEMCACHED_PORT', 11211),
71 | 'weight' => 100,
72 | ],
73 | ],
74 | ],
75 |
76 | 'redis' => [
77 | 'driver' => 'redis',
78 | 'connection' => 'cache',
79 | 'lock_connection' => 'default',
80 | ],
81 |
82 | 'dynamodb' => [
83 | 'driver' => 'dynamodb',
84 | 'key' => env('AWS_ACCESS_KEY_ID'),
85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
88 | 'endpoint' => env('DYNAMODB_ENDPOINT'),
89 | ],
90 |
91 | ],
92 |
93 | /*
94 | |--------------------------------------------------------------------------
95 | | Cache Key Prefix
96 | |--------------------------------------------------------------------------
97 | |
98 | | When utilizing a RAM based store such as APC or Memcached, there might
99 | | be other applications utilizing the same cache. So, we'll specify a
100 | | value to get prefixed to all our keys so we can avoid collisions.
101 | |
102 | */
103 |
104 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
105 |
106 | ];
107 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/index.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @include('layouts.AdminLTE._includes._head')
5 |
6 |
7 | @impersonating($guard = null)
8 |
9 | @else
10 |
11 | @endImpersonating
12 |
13 |
14 |
15 | @include('layouts.AdminLTE._includes._menu_superior')
16 |
17 |
18 | @include('layouts.AdminLTE._includes._menu_lateral')
19 |
20 |
21 |
41 |
42 | @if(Session::has('flash_message'))
43 |
44 |
45 |
46 | {!! Session::get('flash_message')['msg'] !!}
47 |
48 |
49 |
50 | @endif
51 |
52 |
53 |
54 | @impersonating($guard = null)
55 |
56 |
57 |
58 |
59 |
Attention!
60 | Impersonated access.
Exit
61 |
62 |
63 |
64 |
65 | @endImpersonating
66 |
67 |
68 |
69 |
70 | @yield('content')
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | @include('layouts.AdminLTE._includes._footer')
80 |
81 |
82 |
83 | @include('layouts.AdminLTE._includes._script_footer')
84 |
85 |
86 |
--------------------------------------------------------------------------------
/resources/views/layouts/AdminLTE/_includes/_head.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {!! \App\Models\Config::find(1)->app_name_abv !!} | @yield('title')
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
46 |
47 |
62 |
63 | @yield('layout_css')
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_MAILER', 'smtp'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Mailer Configurations
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure all of the mailers used by your application plus
24 | | their respective settings. Several examples have been configured for
25 | | you and you are free to add your own as your application requires.
26 | |
27 | | Laravel supports a variety of mail "transport" drivers to be used while
28 | | sending an e-mail. You will specify which one you are using for your
29 | | mailers below. You are free to add additional mailers as required.
30 | |
31 | | Supported: "smtp", "sendmail", "mailgun", "ses",
32 | | "postmark", "log", "array"
33 | |
34 | */
35 |
36 | 'mailers' => [
37 | 'smtp' => [
38 | 'transport' => 'smtp',
39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
40 | 'port' => env('MAIL_PORT', 587),
41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
42 | 'username' => env('MAIL_USERNAME'),
43 | 'password' => env('MAIL_PASSWORD'),
44 | 'timeout' => null,
45 | 'auth_mode' => null,
46 | ],
47 |
48 | 'ses' => [
49 | 'transport' => 'ses',
50 | ],
51 |
52 | 'mailgun' => [
53 | 'transport' => 'mailgun',
54 | ],
55 |
56 | 'postmark' => [
57 | 'transport' => 'postmark',
58 | ],
59 |
60 | 'sendmail' => [
61 | 'transport' => 'sendmail',
62 | 'path' => '/usr/sbin/sendmail -bs',
63 | ],
64 |
65 | 'log' => [
66 | 'transport' => 'log',
67 | 'channel' => env('MAIL_LOG_CHANNEL'),
68 | ],
69 |
70 | 'array' => [
71 | 'transport' => 'array',
72 | ],
73 | ],
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Global "From" Address
78 | |--------------------------------------------------------------------------
79 | |
80 | | You may wish for all e-mails sent by your application to be sent from
81 | | the same address. Here, you may specify a name and address that is
82 | | used globally for all e-mails that are sent by your application.
83 | |
84 | */
85 |
86 | 'from' => [
87 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
88 | 'name' => env('MAIL_FROM_NAME', 'Example'),
89 | ],
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Markdown Mail Settings
94 | |--------------------------------------------------------------------------
95 | |
96 | | If you are using Markdown based email rendering, you may configure your
97 | | theme and component paths here, allowing you to customize the design
98 | | of the emails. Or, you may simply stick with the Laravel defaults!
99 | |
100 | */
101 |
102 | 'markdown' => [
103 | 'theme' => 'default',
104 |
105 | 'paths' => [
106 | resource_path('views/vendor/mail'),
107 | ],
108 | ],
109 |
110 | ];
111 |
--------------------------------------------------------------------------------
/app/Http/Controllers/User/RoleController.php:
--------------------------------------------------------------------------------
1 | authorize('show-role', Role::class);
18 |
19 | $roles = Role::paginate(15);
20 |
21 | return view('users.roles.index', compact('roles'));
22 | }
23 |
24 | public function show($id)
25 | {
26 | $this->authorize('show-role', User::class);
27 |
28 | $role = Role::find($id);
29 |
30 | if(!$role){
31 | $this->flashMessage('warning', 'Permission not found!', 'danger');
32 | return redirect()->route('role');
33 | }
34 |
35 | $permissions_ids = Permission::permissionsRole($role);
36 |
37 | $permission_groups = PermissionGroup::all();
38 |
39 | return view('users.roles.show',compact('role', 'permissions_ids', 'permission_groups'));
40 | }
41 |
42 | public function create()
43 | {
44 | $this->authorize('create-role', Role::class);
45 |
46 | $permission_groups = PermissionGroup::all();
47 |
48 | return view('users.roles.create', compact('permission_groups'));
49 | }
50 |
51 | public function store(StoreRoleRequest $request)
52 | {
53 | $this->authorize('create-role', Role::class);
54 |
55 | $role = Role::create($request->all());
56 |
57 | $permissions = $request->input('permissions') ? $request->input('permissions') : [];
58 |
59 | $role->permissions()->sync($permissions);
60 |
61 | $this->flashMessage('check', 'Permission successfully added!', 'success');
62 |
63 | return redirect()->route('role.create');
64 | }
65 |
66 | public function edit($id)
67 | {
68 | $this->authorize('edit-role', Role::class);
69 |
70 | $role = Role::find($id);
71 |
72 | if(!$role){
73 | $this->flashMessage('warning', 'Permission not found!', 'danger');
74 | return redirect()->route('role');
75 | }
76 |
77 | $permissions_ids = Permission::permissionsRole($role);
78 |
79 | $permission_groups = PermissionGroup::all();
80 |
81 | return view('users.roles.edit',compact('role', 'permission_groups', 'permissions_ids'));
82 | }
83 |
84 | public function update(UpdateRoleRequest $request,$id)
85 | {
86 | $this->authorize('edit-role', User::class);
87 |
88 | $role = Role::find($id);
89 |
90 | if(!$role){
91 | $this->flashMessage('warning', 'Permission not found!', 'danger');
92 | return redirect()->route('role');
93 | }
94 |
95 | $role->update($request->all());
96 |
97 | $permissions = $request->input('permissions') ? $request->input('permissions') : [];
98 |
99 | $role->permissions()->sync($permissions);
100 |
101 | $this->flashMessage('check', 'Permission successfully updated!', 'success');
102 |
103 | return redirect()->route('role');
104 | }
105 |
106 | public function destroy($id)
107 | {
108 | $this->authorize('destroy-role', Role::class);
109 |
110 | $role = Role::find($id);
111 |
112 | if(!$role){
113 | $this->flashMessage('warning', 'Permissão não encontrada!', 'danger');
114 | return redirect()->route('role');
115 | }
116 |
117 | $role->delete();
118 |
119 | $this->flashMessage('check', 'Permission successfully deleted!', 'success');
120 |
121 | return redirect()->route('role');
122 | }
123 | }
--------------------------------------------------------------------------------
/resources/views/auth/passwords/reset.blade.php:
--------------------------------------------------------------------------------
1 | @section('title', 'Reset Password')
2 | @section('layout_css')
3 |
9 | @stop
10 |
11 |
12 |
13 |
14 |
15 | @include('layouts.AdminLTE._includes._head')
16 |
17 |
18 |
19 |
20 |
21 |
22 | @if(\App\Models\Config::find(1)->img_login == 'T')
23 |
24 |
25 | @endif
26 |
27 | {!! \App\Models\Config::find(1)->titulo_login !!}
28 |
29 |
74 |
75 |
76 | @include('layouts.AdminLTE._includes._script_footer')
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/resources/views/auth/login.blade.php:
--------------------------------------------------------------------------------
1 | @section('title', 'Login')
2 | @section('layout_css')
3 |
9 | @stop
10 |
11 |
12 |
13 |
14 |
15 | @include('layouts.AdminLTE._includes._head')
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | @if(\App\Models\Config::find(1)->img_login == 'T')
26 |
27 |
28 | @endif
29 |
30 | {!! \App\Models\Config::find(1)->titulo_login !!}
31 |
32 |
33 |
Sign in to start your session
34 |
77 |
78 |
79 |
80 | @include('layouts.AdminLTE._includes._script_footer')
81 |
90 |
91 |
--------------------------------------------------------------------------------
/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 | 'hash' => false,
48 | ],
49 | ],
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | User Providers
54 | |--------------------------------------------------------------------------
55 | |
56 | | All authentication drivers have a user provider. This defines how the
57 | | users are actually retrieved out of your database or other storage
58 | | mechanisms used by this application to persist your user's data.
59 | |
60 | | If you have multiple user tables or models you may configure multiple
61 | | sources which represent each model / table. These sources may then
62 | | be assigned to any extra authentication guards you have defined.
63 | |
64 | | Supported: "database", "eloquent"
65 | |
66 | */
67 |
68 | 'providers' => [
69 | 'users' => [
70 | 'driver' => 'eloquent',
71 | 'model' => App\Models\User::class,
72 | ],
73 |
74 | // 'users' => [
75 | // 'driver' => 'database',
76 | // 'table' => 'users',
77 | // ],
78 | ],
79 |
80 | /*
81 | |--------------------------------------------------------------------------
82 | | Resetting Passwords
83 | |--------------------------------------------------------------------------
84 | |
85 | | You may specify multiple password reset configurations if you have more
86 | | than one user table or model in the application and you want to have
87 | | separate password reset settings based on the specific user types.
88 | |
89 | | The expire time is the number of minutes that the reset token should be
90 | | considered valid. This security feature keeps tokens short-lived so
91 | | they have less time to be guessed. You may change this as needed.
92 | |
93 | */
94 |
95 | 'passwords' => [
96 | 'users' => [
97 | 'provider' => 'users',
98 | 'table' => 'password_resets',
99 | 'expire' => 60,
100 | 'throttle' => 60,
101 | ],
102 | ],
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Password Confirmation Timeout
107 | |--------------------------------------------------------------------------
108 | |
109 | | Here you may define the amount of seconds before a password confirmation
110 | | times out and the user is prompted to re-enter their password via the
111 | | confirmation screen. By default, the timeout lasts for three hours.
112 | |
113 | */
114 |
115 | 'password_timeout' => 10800,
116 |
117 | ];
118 |
--------------------------------------------------------------------------------
/resources/views/auth/register.blade.php:
--------------------------------------------------------------------------------
1 | @if(\App\Models\Config::find(1)->register != 'T')
2 | @php
3 | header("Location: /");
4 | exit();
5 | @endphp
6 | @endif
7 |
8 | @section('title', 'Register')
9 | @section('layout_css')
10 |
16 | @stop
17 |
18 |
19 |
20 |
21 |
22 | @include('layouts.AdminLTE._includes._head')
23 |
24 |
25 |
26 |
27 |
28 |
29 | @if(\App\Models\Config::find(1)->img_login == 'T')
30 |
31 |
32 | @endif
33 |
34 | {!! \App\Models\Config::find(1)->titulo_login !!}
35 |
36 |
37 |
Register a new membership
38 |
84 |
85 |
86 |
87 | @include('layouts.AdminLTE._includes._script_footer')
88 |
89 |
90 |
--------------------------------------------------------------------------------
/database/seeders/PermissionRoleTablesSeeder.php:
--------------------------------------------------------------------------------
1 | createRoles();
31 |
32 | // cria os grupos de persmissões
33 | $this->createPermissionGroups();
34 |
35 | // cria as permissões
36 | $this->createPermissions();
37 |
38 | // vincula as permissões aos papéis
39 | $this->sync();
40 | }
41 |
42 | private function createRoles()
43 | {
44 | Role::create([
45 | 'name' => 'Developer',
46 | 'label' => 'System Developer'
47 | ]);
48 |
49 | Role::create([
50 | 'name' => 'Administrators',
51 | 'label' => 'System Administrators'
52 | ]);
53 |
54 | $this->command->info('Roles created!');
55 | }
56 |
57 | private function createPermissionGroups()
58 | {
59 | PermissionGroup::create([
60 | 'name' => 'Developer Settings', //1
61 | ]);
62 |
63 | PermissionGroup::create([
64 | 'name' => 'System Settings', //2
65 | ]);
66 |
67 | PermissionGroup::create([
68 | 'name' => 'Users', //3
69 | ]);
70 |
71 | PermissionGroup::create([
72 | 'name' => 'Permissions', //4
73 | ]);
74 |
75 | $this->command->info('Permission Groups created!');
76 | }
77 |
78 | private function createPermissions()
79 | {
80 | Permission::create([
81 | 'permission_group_id' => '1',
82 | 'name' => 'root-dev',
83 | 'label' => 'Developer Permission'
84 | ]);
85 |
86 | Permission::create([
87 | 'permission_group_id' => '2',
88 | 'name' => 'edit-config',
89 | 'label' => 'Edit System Settings'
90 | ]);
91 |
92 | Permission::create([
93 | 'permission_group_id' => '3',
94 | 'name' => 'show-user',
95 | 'label' => 'View User'
96 | ]);
97 |
98 | Permission::create([
99 | 'permission_group_id' => '3',
100 | 'name' => 'create-user',
101 | 'label' => 'Add User'
102 | ]);
103 |
104 | Permission::create([
105 | 'permission_group_id' => '3',
106 | 'name' => 'edit-user',
107 | 'label' => 'Edit User'
108 | ]);
109 |
110 | Permission::create([
111 | 'permission_group_id' => '3',
112 | 'name' => 'destroy-user',
113 | 'label' => 'Delete User'
114 | ]);
115 |
116 | Permission::create([
117 | 'permission_group_id' => '4',
118 | 'name' => 'show-role',
119 | 'label' => 'View Permission'
120 | ]);
121 |
122 | Permission::create([
123 | 'permission_group_id' => '4',
124 | 'name' => 'create-role',
125 | 'label' => 'Add Permission'
126 | ]);
127 |
128 | Permission::create([
129 | 'permission_group_id' => '4',
130 | 'name' => 'edit-role',
131 | 'label' => 'Edit Permission'
132 | ]);
133 |
134 | Permission::create([
135 | 'permission_group_id' => '4',
136 | 'name' => 'destroy-role',
137 | 'label' => 'Delete Permission'
138 | ]);
139 |
140 | $this->command->info('Permissions created!');
141 | }
142 |
143 | private function sync()
144 | {
145 | $permissions_id = Permission::permissionsId(1);
146 | $role = Role::find(1);
147 | $role->permissions()->sync($permissions_id);
148 |
149 | $permissions_id = Permission::permissionsId(2);
150 | $role = Role::find(2);
151 | $role->permissions()->sync($permissions_id);
152 |
153 | $this->command->info('Persistence linked to roles!');
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/resources/views/users/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'user')
4 |
5 | @section('title', 'Users')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 |
18 |
19 |
20 | @endsection
21 |
22 | @section('content')
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Name
33 | E-mail
34 | Status
35 | Created
36 | Actions
37 |
38 |
39 |
40 | @foreach($users as $user)
41 | @if ($user->id != 1)
42 |
43 |
44 | @if($user->isOnline())
45 |
46 | @else
47 |
48 | @endif
49 | {{ $user->name }}
50 |
51 | {{ $user->email }}
52 |
53 | @if($user->active == true)
54 | Active
55 | @else
56 | Inactive
57 | @endif
58 |
59 | {{ $user->created_at->format('d/m/Y H:i') }}
60 |
61 |
62 |
63 |
64 |
65 | @if (Auth::user()->can('root-dev', ''))
66 |
67 | @endif
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
Do you really want to delete ({{ $user->name }}) ?
81 |
82 |
86 |
87 |
88 |
89 | @endif
90 | @endforeach
91 |
92 |
93 |
94 | Name
95 | E-mail
96 | Status
97 | Created
98 | Actions
99 |
100 |
101 |
102 |
103 |
104 |
105 | {{ $users->links() }}
106 |
107 |
108 |
109 |
110 |
111 | @endsection
--------------------------------------------------------------------------------
/app/Http/Controllers/User/UserController.php:
--------------------------------------------------------------------------------
1 | authorize('show-user', User::class);
18 |
19 | $users = User::paginate(15);
20 |
21 | return view('users.index', compact('users'));
22 | }
23 |
24 | public function show($id)
25 | {
26 | $this->authorize('show-user', User::class);
27 |
28 | $user = User::find($id);
29 |
30 | if(!$user){
31 | $this->flashMessage('warning', 'User not found!', 'danger');
32 | return redirect()->route('user');
33 | }
34 |
35 | $roles = Role::all();
36 |
37 | $roles_ids = Role::rolesUser($user);
38 |
39 | return view('users.show',compact('user', 'roles', 'roles_ids'));
40 | }
41 |
42 | public function create()
43 | {
44 | $this->authorize('create-user', User::class);
45 |
46 | $roles = Role::all();
47 |
48 | return view('users.create',compact('roles'));
49 | }
50 |
51 | public function store(StoreUserRequest $request)
52 | {
53 | $this->authorize('create-user', User::class);
54 |
55 | $request->merge(['password' => bcrypt($request->get('password'))]);
56 |
57 | $user = User::create($request->all());
58 |
59 | $roles = $request->input('roles') ? $request->input('roles') : [];
60 |
61 | $user->roles()->sync($roles);
62 |
63 | $this->flashMessage('check', 'User successfully added!', 'success');
64 |
65 | return redirect()->route('user.create');
66 | }
67 |
68 | public function edit($id)
69 | {
70 | $this->authorize('edit-user', User::class);
71 |
72 | $user = User::find($id);
73 |
74 | if(!$user){
75 | $this->flashMessage('warning', 'User not found!', 'danger');
76 | return redirect()->route('user');
77 | }
78 |
79 | $roles = Role::all();
80 |
81 | $roles_ids = Role::rolesUser($user);
82 |
83 | return view('users.edit',compact('user', 'roles', 'roles_ids'));
84 | }
85 |
86 | public function update(UpdateUserRequest $request,$id)
87 | {
88 | $this->authorize('edit-user', User::class);
89 |
90 | $user = User::find($id);
91 |
92 | if(!$user){
93 | $this->flashMessage('warning', 'User not found!', 'danger');
94 | return redirect()->route('user');
95 | }
96 |
97 | $user->update($request->all());
98 |
99 | $roles = $request->input('roles') ? $request->input('roles') : [];
100 |
101 | $user->roles()->sync($roles);
102 |
103 | $this->flashMessage('check', 'User updated successfully!', 'success');
104 |
105 | return redirect()->route('user');
106 | }
107 |
108 | public function updatePassword(UpdatePasswordUserRequest $request,$id)
109 | {
110 | $this->authorize('edit-user', User::class);
111 |
112 | $user = User::find($id);
113 |
114 | if(!$user){
115 | $this->flashMessage('warning', 'User not found!', 'danger');
116 | return redirect()->route('user');
117 | }
118 |
119 | $request->merge(['password' => bcrypt($request->get('password'))]);
120 |
121 | $user->update($request->all());
122 |
123 | $this->flashMessage('check', 'User password updated successfully!', 'success');
124 |
125 | return redirect()->route('user');
126 | }
127 |
128 | public function editPassword($id)
129 | {
130 | $this->authorize('edit-user', User::class);
131 |
132 | $user = User::find($id);
133 |
134 | if(!$user){
135 | $this->flashMessage('warning', 'User not found!', 'danger');
136 | return redirect()->route('user');
137 | }
138 |
139 | return view('users.edit_password',compact('user'));
140 | }
141 |
142 | public function destroy($id)
143 | {
144 | $this->authorize('destroy-user', User::class);
145 |
146 | $user = User::find($id);
147 |
148 | if(!$user){
149 | $this->flashMessage('warning', 'User not found!', 'danger');
150 | return redirect()->route('user');
151 | }
152 |
153 | $user->delete();
154 |
155 | $this->flashMessage('check', 'User successfully deleted!', 'success');
156 |
157 | return redirect()->route('user');
158 | }
159 | }
--------------------------------------------------------------------------------
/resources/views/users/roles/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'plus')
4 |
5 | @section('title', 'Add Permission')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 | @endsection
16 |
17 | @section('content')
18 |
19 |
84 |
85 | @endsection
86 |
87 | @section('layout_js')
88 |
89 |
98 |
99 | @endsection
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Database Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here are each of the database connections setup for your application.
26 | | Of course, examples of configuring each database platform that is
27 | | supported by Laravel is shown below to make development simple.
28 | |
29 | |
30 | | All database work in Laravel is done through the PHP PDO facilities
31 | | so make sure you have the driver for your particular database of
32 | | choice installed on your machine before you begin development.
33 | |
34 | */
35 |
36 | 'connections' => [
37 |
38 | 'sqlite' => [
39 | 'driver' => 'sqlite',
40 | 'url' => env('DATABASE_URL'),
41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
42 | 'prefix' => '',
43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
44 | ],
45 |
46 | 'mysql' => [
47 | 'driver' => 'mysql',
48 | 'url' => env('DATABASE_URL'),
49 | 'host' => env('DB_HOST', '127.0.0.1'),
50 | 'port' => env('DB_PORT', '3306'),
51 | 'database' => env('DB_DATABASE', 'forge'),
52 | 'username' => env('DB_USERNAME', 'forge'),
53 | 'password' => env('DB_PASSWORD', ''),
54 | 'unix_socket' => env('DB_SOCKET', ''),
55 | 'charset' => 'utf8mb4',
56 | 'collation' => 'utf8mb4_unicode_ci',
57 | 'prefix' => '',
58 | 'prefix_indexes' => true,
59 | 'strict' => true,
60 | 'engine' => null,
61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([
62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
63 | ]) : [],
64 | ],
65 |
66 | 'pgsql' => [
67 | 'driver' => 'pgsql',
68 | 'url' => env('DATABASE_URL'),
69 | 'host' => env('DB_HOST', '127.0.0.1'),
70 | 'port' => env('DB_PORT', '5432'),
71 | 'database' => env('DB_DATABASE', 'forge'),
72 | 'username' => env('DB_USERNAME', 'forge'),
73 | 'password' => env('DB_PASSWORD', ''),
74 | 'charset' => 'utf8',
75 | 'prefix' => '',
76 | 'prefix_indexes' => true,
77 | 'schema' => 'public',
78 | 'sslmode' => 'prefer',
79 | ],
80 |
81 | 'sqlsrv' => [
82 | 'driver' => 'sqlsrv',
83 | 'url' => env('DATABASE_URL'),
84 | 'host' => env('DB_HOST', 'localhost'),
85 | 'port' => env('DB_PORT', '1433'),
86 | 'database' => env('DB_DATABASE', 'forge'),
87 | 'username' => env('DB_USERNAME', 'forge'),
88 | 'password' => env('DB_PASSWORD', ''),
89 | 'charset' => 'utf8',
90 | 'prefix' => '',
91 | 'prefix_indexes' => true,
92 | ],
93 |
94 | ],
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Migration Repository Table
99 | |--------------------------------------------------------------------------
100 | |
101 | | This table keeps track of all the migrations that have already run for
102 | | your application. Using this information, we can determine which of
103 | | the migrations on disk haven't actually been run in the database.
104 | |
105 | */
106 |
107 | 'migrations' => 'migrations',
108 |
109 | /*
110 | |--------------------------------------------------------------------------
111 | | Redis Databases
112 | |--------------------------------------------------------------------------
113 | |
114 | | Redis is an open source, fast, and advanced key-value store that also
115 | | provides a richer body of commands than a typical key-value system
116 | | such as APC or Memcached. Laravel makes it easy to dig right in.
117 | |
118 | */
119 |
120 | 'redis' => [
121 |
122 | 'client' => env('REDIS_CLIENT', 'phpredis'),
123 |
124 | 'options' => [
125 | 'cluster' => env('REDIS_CLUSTER', 'redis'),
126 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
127 | ],
128 |
129 | 'default' => [
130 | 'url' => env('REDIS_URL'),
131 | 'host' => env('REDIS_HOST', '127.0.0.1'),
132 | 'password' => env('REDIS_PASSWORD', null),
133 | 'port' => env('REDIS_PORT', '6379'),
134 | 'database' => env('REDIS_DB', '0'),
135 | ],
136 |
137 | 'cache' => [
138 | 'url' => env('REDIS_URL'),
139 | 'host' => env('REDIS_HOST', '127.0.0.1'),
140 | 'password' => env('REDIS_PASSWORD', null),
141 | 'port' => env('REDIS_PORT', '6379'),
142 | 'database' => env('REDIS_CACHE_DB', '1'),
143 | ],
144 |
145 | ],
146 |
147 | ];
148 |
--------------------------------------------------------------------------------
/resources/lang/pt_BR.json:
--------------------------------------------------------------------------------
1 | {
2 | "Name": "Nome",
3 | "E-Mail Address": "Email",
4 | "Password": "Senha",
5 | "Confirm": "Confirmar",
6 | "Confirm Password": "Confirmação de senha",
7 | "Remember Me": "Manter conectado",
8 | "Remember me": "Manter conectado",
9 | "Forgot Your Password?": "Esqueceu sua senha?",
10 | "Forgot your password?": "Esqueceu sua senha?",
11 | "Already registered?": "Já registrado?",
12 | "Login": "Entrar",
13 | "Register": "Registre-se",
14 | "Home": "Principal",
15 | "Logout": "Sair",
16 | "Toggle navigation": "Alternar navegação",
17 | "Nevermind": "Deixa pra lá",
18 | "Verify Your Email Address": "Verifique seu endereço de email",
19 | "A fresh verification link has been sent to your email address.": "Um novo link de verificação foi enviado para seu email",
20 | "Before proceeding, please check your email for a verification link.": "Antes de prosseguir, por favor, veja se recebeu o link de verificação em seu email",
21 | "If you did not receive the email": "Se você não recebeu o email",
22 | "click here to request another": "clique aqui para solicitar outro",
23 | "Please click the button below to verify your email address.": "Clique no botão abaixo para verificar seu endereço de e-mail",
24 | "Verify Email Address": "Verificar E-mail",
25 | "If you did not create an account, no further action is required.": "Se você não criou a conta, favor desconsiderar este e-mail",
26 | "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Se você estiver com problemas para clicar no botão \":actionText\", copie e cole o URL abaixo\nem seu navegador da web:",
27 | "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser: [:displayableActionUrl](:actionURL)": "Se você estiver com problemas para clicar no botão \":actionText\", copie e cole o URL abaixo\nem seu navegador da web: [:displayableActionUrl](:actionURL)",
28 | "Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.": "Esqueceu sua senha? Sem problemas. Apenas informe seu endereço de email que enviaremos um link que permitirá definir uma nova senha.",
29 | "Send Password Reset Link": "Enviar link para redefinir senha",
30 | "Email Password Reset Link": "Enviar link para redefinir senha",
31 | "Reset Password": "Modificar Senha",
32 | "This is a secure area of the application. Please confirm your password before continuing.": "Essa é uma área segura da aplicação. Por favor confirme sua senha antes de continuar.",
33 | "You are receiving this email because we received a password reset request for your account.": "Você está recebendo este e-mail porque recebemos uma solicitação de redefinição de senha para sua conta.",
34 | "If you did not request a password reset, no further action is required.": "Se você não solicitou a redefinição de senha, nenhuma ação adicional será necessária.",
35 | "This password reset link will expire in :count minutes.": "Este link de redefinição de senha expirará em :count minutos.",
36 | "Please confirm your password before continuing.": "Por favor, confirme sua senha para continuar.",
37 | "Hello!": "Olá!",
38 | "Regards": "Saudações",
39 | "Reset Password Notification": "Notificação de redefinição de senha",
40 | "All rights reserved.": "Todos os direitos reservados.",
41 | "The :attribute must be at least :length characters and contain at least one uppercase character.": "O campo :attribute deve ter pelo menos :length e conter pelo menos um caractere maiúsculo.",
42 | "The :attribute must be at least :length characters and contain at least one number.": "O campo :attribute deve ter pelo menos :length caracteres e conter pelo menos um número.",
43 | "The :attribute must be at least :length characters and contain at least one special character.": "O campo :attribute deve ter pelo menos :length caracteres e conter pelo menos um caractere especial.",
44 | "The :attribute must be at least :length characters and contain at least one uppercase character and one number.": "O campo :attribute deve ter pelo menos :length caracteres e conter pelo menos um caractere maiúsculo e um número.",
45 | "The :attribute must be at least :length characters and contain at least one uppercase character and one special character.": "O campo :attribute deve ter pelo menos :length caracteres e conter pelo menos um caractere maiúsculo e um caractere especial.",
46 | "The :attribute must be at least :length characters and contain at least one uppercase character, one number, and one special character.": "O campo :attribute deve ter pelo menos :length caracteres e conter pelo menos um caractere maiúsculo, um número e um caractere especial.",
47 | "The :attribute must be at least :length characters.": "O campo :attribute deve ter pelo menos :length caracteres.",
48 | "You have been invited to join the :team team!": "Você foi convidado para entrar no time :team!",
49 | "If you do not have an account, you may create one by clicking the button below. After creating an account, you may click the invitation acceptance button in this email to accept the team invitation:": "Caso não tenha uma conta, você pode criar uma usando o botão abaixo. Após criar a conta, você pode clicar no botão de aceitar convite nesse email para aceitar o convite para o time",
50 | "Create Account": "Criar Conta",
51 | "If you already have an account, you may accept this invitation by clicking the button below:": "Se já tiver uma conta, você pode aceitar esse convite através do botão abaixo:",
52 | "Accept Invitation": "Aceitar Convite",
53 | "If you did not expect to receive an invitation to this team, you may discard this email.": "Se você não sabe porque está recebendo um convite para esse time, pode descartar esse email"
54 | }
--------------------------------------------------------------------------------
/resources/views/users/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'pencil')
4 |
5 | @section('title', 'Edit User')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 | @endsection
16 |
17 | @section('content')
18 | @if ($user->id != 1)
19 |
92 | @endif
93 |
94 | @endsection
95 |
96 | @section('layout_js')
97 |
98 |
115 |
116 | @endsection
--------------------------------------------------------------------------------
/resources/views/users/roles/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.AdminLTE.index')
2 |
3 | @section('icon_page', 'pencil')
4 |
5 | @section('title', 'Edit Permission')
6 |
7 | @section('menu_pagina')
8 |
9 |
10 |
13 |
14 |
15 | @endsection
16 |
17 | @section('content')
18 | @if($role->id != 1)
19 |
90 | @endif
91 |
92 | @endsection
93 |
94 | @section('layout_js')
95 |
96 |
105 |
106 | @endsection
--------------------------------------------------------------------------------