├── .docker ├── docker │ └── Dockerfile └── nginx │ └── nginx.conf ├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── README.md ├── _ide_helper.php ├── app ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Auth │ │ │ ├── LoginController.php │ │ │ └── RegisterController.php │ │ ├── Controller.php │ │ ├── PermissionsController.php │ │ ├── RolesController.php │ │ ├── RolesPermissionsController.php │ │ ├── UsersController.php │ │ └── UsersRolesController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php │ ├── RequestRestFulFilter │ │ ├── BaseRequestRestFullFilter.php │ │ ├── OrderBy.php │ │ ├── Paginate.php │ │ ├── Select.php │ │ └── Where.php │ └── Requests │ │ ├── BaseRequest.php │ │ ├── PermissionRequest.php │ │ ├── RecoveryRequest.php │ │ ├── RecoveryUpdatePasswordRequest.php │ │ ├── RolePermissionRequest.php │ │ ├── RoleRequest.php │ │ ├── UserRequest.php │ │ └── UserRoleRequest.php ├── Models │ ├── Auth │ │ ├── Permission.php │ │ ├── Role.php │ │ └── User.php │ └── BaseModel.php ├── Notifications │ ├── SendEmailRecovery.php │ └── SendEmailVerification.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Scopes │ └── OwnerScope.php └── Traits │ └── Treat.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── database.php ├── entrust.php ├── filesystems.php ├── hashing.php ├── jwt.php ├── logging.php ├── mail.php ├── queue.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ └── 2019_06_17_123029_entrust_setup_tables.php └── seeds │ ├── DatabaseSeeder.php │ ├── PermissionRoleTableSeeder.php │ ├── PermissionsTableSeeder.php │ ├── RoleUserTableSeeder.php │ ├── RolesTableSeeder.php │ └── UsersTableSeeder.php ├── docker-compose.yml ├── package.json ├── phpunit.phar ├── phpunit.xml ├── public ├── .htaccess ├── css │ └── app.css ├── favicon.ico ├── index.php ├── js │ └── app.js └── robots.txt ├── resources ├── js │ ├── app.js │ ├── bootstrap.js │ └── components │ │ └── ExampleComponent.vue ├── lang │ ├── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php │ └── pt-BR │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php ├── sass │ ├── _variables.scss │ └── app.scss └── views │ ├── emails │ ├── account_recovery.blade.php │ └── account_verification.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── api │ ├── login.php │ ├── permissions.php │ ├── register.php │ ├── roles.php │ └── users.php ├── channels.php ├── console.php └── web.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ ├── ExampleTest.php │ └── UserTest.php └── webpack.mix.js /.docker/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.3-fpm 2 | LABEL maintainer="smedeiros.flavio@gmail.com" 3 | 4 | RUN apt-get update && apt-get install -y \ 5 | build-essential \ 6 | mariadb-client \ 7 | libpng-dev \ 8 | libjpeg62-turbo-dev \ 9 | libfreetype6-dev \ 10 | libzip-dev \ 11 | locales \ 12 | zip \ 13 | libhiredis-dev \ 14 | jpegoptim optipng pngquant gifsicle 15 | 16 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* 17 | 18 | RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath opcache 19 | RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ 20 | RUN docker-php-ext-install gd 21 | 22 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 23 | 24 | RUN echo pt_BR.UTF-8 UTF-8 > /etc/locale.gen && locale-gen 25 | 26 | WORKDIR /application 27 | -------------------------------------------------------------------------------- /.docker/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8000; 3 | index index.php index.html index.htm; 4 | root /application/public; # default Laravel's entry point for all requests 5 | 6 | access_log /var/log/nginx/access.log; 7 | error_log /var/log/nginx/error.log; 8 | 9 | location / { 10 | # try to serve file directly, fallback to index.php 11 | try_files $uri /index.php?$args; 12 | } 13 | 14 | location ~ \.php$ { 15 | fastcgi_index index.php; 16 | fastcgi_pass api-users-app:9000; # address of a fastCGI server 17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 18 | fastcgi_param PATH_INFO $fastcgi_path_info; 19 | include fastcgi_params; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.yml] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # Variables are populated by docker-composer.yml 2 | 3 | APP_NAME="Users API" 4 | APP_ENV=local 5 | APP_KEY=base64:5dGjgAI1Y7Jw/Loxsyjuh9qNP01TE8Oy39jKk0JNT6w= 6 | APP_DEBUG=true 7 | APP_URL=http://localhost:8000 8 | 9 | LOG_CHANNEL=stack 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=api-users-mysql 13 | DB_PORT=3306 14 | DB_DATABASE=users 15 | DB_USERNAME=root 16 | DB_PASSWORD=root 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=redis 20 | QUEUE_CONNECTION=sync 21 | SESSION_DRIVER=redis 22 | SESSION_LIFETIME=120 23 | 24 | REDIS_HOST=api-users-redis 25 | REDIS_PASSWORD=null 26 | REDIS_PORT=6379 27 | 28 | MAIL_DRIVER=smtp 29 | MAIL_HOST=smtp.mailtrap.io 30 | MAIL_PORT=2525 31 | MAIL_USERNAME= 32 | MAIL_PASSWORD= 33 | MAIL_ENCRYPTION=null 34 | 35 | AWS_ACCESS_KEY_ID= 36 | AWS_SECRET_ACCESS_KEY= 37 | AWS_DEFAULT_REGION=us-east-1 38 | AWS_BUCKET= 39 | 40 | PUSHER_APP_ID= 41 | PUSHER_APP_KEY= 42 | PUSHER_APP_SECRET= 43 | PUSHER_APP_CLUSTER=mt1 44 | 45 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 46 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 47 | 48 | JWT_SECRET= 49 | # expire jwt in minutes | 1440 => 1 day 50 | JWT_TTL=60 51 | # expire refresh token in minutes | 20160 => 2 weeks 52 | JWT_REFRESH_TTL=20160 53 | JWT_BLACKLIST_ENABLED=true 54 | 55 | # Minutes for expire link active account 56 | AUTH_VERIFICATION_EXPIRE=60 57 | 58 | PAGINATE_PER_PAGE=15 59 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | .env 7 | .phpunit.result.cache 8 | Homestead.json 9 | Homestead.yaml 10 | npm-debug.log 11 | yarn-error.log 12 | 13 | *.log 14 | /.idea 15 | 16 | yarn.lock 17 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | disabled: 4 | - unused_use 5 | finder: 6 | not-name: 7 | - index.php 8 | - server.php 9 | js: 10 | finder: 11 | not-name: 12 | - webpack.mix.js 13 | css: true 14 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | $this->load(__DIR__.'/Commands'); 39 | 40 | require base_path('routes/console.php'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | isNotFound($exception) && $request->wantsJson()) 53 | return response()->json(['message' => 'Not found'], 404); 54 | 55 | 56 | return parent::render($request, $exception); 57 | } 58 | 59 | 60 | public function isNotFound(Exception $exception) 61 | { 62 | if ($exception instanceof NotFoundHttpException) 63 | return true; 64 | elseif ($exception instanceof ModelNotFoundException) 65 | return true; 66 | 67 | return false; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | only(['email', 'phone', 'password']); 16 | 17 | if (! $token = auth()->attempt($credentials)) { 18 | return response()->json(['message' => 'Unauthorized'], Response::HTTP_UNAUTHORIZED); 19 | } 20 | 21 | return $this->respondWithToken($token); 22 | } 23 | 24 | 25 | public function me(): JsonResponse 26 | { 27 | return response()->json(auth()->user(), Response::HTTP_OK); 28 | } 29 | 30 | 31 | public function logout(): JsonResponse 32 | { 33 | auth()->logout(); 34 | 35 | return response()->json(['message' => 'Successfully logged out'], Response::HTTP_OK); 36 | } 37 | 38 | 39 | public function refresh(): JsonResponse 40 | { 41 | return $this->respondWithToken(auth()->refresh()); 42 | } 43 | 44 | 45 | protected function respondWithToken($token): JsonResponse 46 | { 47 | return response()->json([ 48 | 'access_token' => $token, 49 | 'token_type' => 'bearer', 50 | 'expires_in' => auth()->factory()->getTTL() * 60, 51 | ], Response::HTTP_OK); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | all()); 29 | $email = $this->sendEmailVerification($user->email); 30 | 31 | if ($email->getStatusCode() !== 200) { 32 | throw new \Exception(json_decode($email->getContent())->message); 33 | } 34 | 35 | }); 36 | 37 | return $email; 38 | 39 | } catch (\Exception $e) { 40 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 41 | } 42 | } 43 | 44 | 45 | public function sendEmailVerification(string $email): JsonResponse 46 | { 47 | try { 48 | $user = User::byEmail($email)->first(); 49 | 50 | if ($user && $user->hasVerifiedEmail() === false) { 51 | 52 | $user->notify(new SendEmailVerification); 53 | 54 | return response()->json(['message' => 'Access your email to verify your account'], 55 | Response::HTTP_CREATED); 56 | } 57 | 58 | return response()->json(['message' => 'Your account not exist or has already been verified previously'], 59 | Response::HTTP_BAD_REQUEST); 60 | 61 | } catch (\Exception $e) { 62 | return response()->json(['message' => 'Failed to send confirmation email. Details: ' . $e->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR); 63 | } 64 | 65 | } 66 | 67 | 68 | public function verification(Request $request) 69 | { 70 | if ($request->hasValidSignature()) { 71 | 72 | $user = User::byEmail($request->user)->first(); 73 | 74 | if (!$user) 75 | $user = User::byPhone($request->user)->first(); 76 | 77 | if ($user && $user->hasVerifiedEmail() === false) { 78 | $user->markEmailAsVerified(); 79 | return response()->json(['message' => 'Account successfully verified'], Response::HTTP_OK); 80 | } 81 | } 82 | 83 | return response()->json(['message' => 'Link expired'], Response::HTTP_BAD_REQUEST); 84 | } 85 | 86 | 87 | public function recovery(RecoveryRequest $request, string $email) 88 | { 89 | if (($user = User::byEmail($email)->first()) && $request->url) { 90 | return $this->sendEmailRecovery($user, $request->url); 91 | } 92 | 93 | return response()->json(['message' => 'Not Found'], Response::HTTP_BAD_REQUEST); 94 | } 95 | 96 | 97 | private function sendEmailRecovery(User $user, string $url) 98 | { 99 | try { 100 | $token = sha1($user->toJson() . now() . Str::random(10)); 101 | $url = "{$url}?token={$token}"; 102 | 103 | $this->verification(new SendEmailRecovery($url)); 104 | 105 | DB::table('password_resets')->updateOrInsert(['email' => $user->email], ['token' => $token, 'created_at' => now()]); 106 | 107 | return response()->json(['message' => 'Access your email to recovery your password'], Response::HTTP_CREATED); 108 | 109 | } catch (\Exception $e) { 110 | 111 | return response()->json(['message' => 'Internal error: ' . $e->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR); 112 | } 113 | } 114 | 115 | 116 | public function updatePassword(RecoveryUpdatePasswordRequest $request) 117 | { 118 | $password_reset = DB::table('password_resets')->where('token', $request->token); 119 | 120 | if ($email_user = $password_reset->first()) { 121 | if ($user = User::byEmail($email_user->email)->first()) { 122 | $user->password = $request->password; 123 | $user->save(); 124 | $password_reset->delete(); 125 | return response()->json(['message' => 'Password changed successfully'], Response::HTTP_OK); 126 | } 127 | } 128 | 129 | return response()->json(['message' => 'Link expired'], Response::HTTP_BAD_REQUEST); 130 | } 131 | } 132 | 133 | 134 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | json($resources); 19 | 20 | } catch (\Exception $e) { 21 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 22 | } 23 | } 24 | 25 | 26 | public function store(PermissionRequest $request): JsonResponse 27 | { 28 | try { 29 | $resource = Permission::create($request->all()); 30 | return response()->json($resource, Response::HTTP_CREATED); 31 | 32 | } catch (\Exception $e) { 33 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 34 | } 35 | } 36 | 37 | 38 | public function show(Permission $permission): JsonResponse 39 | { 40 | try { 41 | return response()->json($permission, Response::HTTP_OK); 42 | 43 | } catch (\Exception $e) { 44 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 45 | } 46 | } 47 | 48 | 49 | public function update(PermissionRequest $request, Permission $permission): JsonResponse 50 | { 51 | try { 52 | $permission->update($request->all()); 53 | return response()->json($permission, Response::HTTP_OK); 54 | 55 | } catch (\Exception $e) { 56 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 57 | } 58 | } 59 | 60 | 61 | public function destroy(Permission $permission): JsonResponse 62 | { 63 | try { 64 | $permission->delete(); 65 | return response()->json($permission, Response::HTTP_OK); 66 | 67 | } catch (\Exception $e) { 68 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/Http/Controllers/RolesController.php: -------------------------------------------------------------------------------- 1 | json($resources, Response::HTTP_OK); 19 | 20 | } catch (\Exception $e) { 21 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 22 | } 23 | } 24 | 25 | 26 | public function store(RoleRequest $request): JsonResponse 27 | { 28 | try { 29 | $resource = Role::create($request->all()); 30 | return response()->json($resource, Response::HTTP_CREATED); 31 | 32 | } catch (\Exception $e) { 33 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 34 | } 35 | } 36 | 37 | 38 | public function show(Role $role): JsonResponse 39 | { 40 | try { 41 | return response()->json($role, Response::HTTP_OK); 42 | 43 | } catch (\Exception $e) { 44 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 45 | } 46 | } 47 | 48 | 49 | public function update(RoleRequest $request, Role $role): JsonResponse 50 | { 51 | try { 52 | $role->update($request->all()); 53 | return response()->json($role, Response::HTTP_OK); 54 | 55 | } catch (\Exception $e) { 56 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 57 | } 58 | } 59 | 60 | 61 | public function destroy(Role $role): JsonResponse 62 | { 63 | try { 64 | $role->delete(); 65 | return response()->json($role, Response::HTTP_OK); 66 | 67 | } catch (\Exception $e) { 68 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/Http/Controllers/RolesPermissionsController.php: -------------------------------------------------------------------------------- 1 | perms()->treat($request); 18 | return response()->json($resources); 19 | 20 | } catch (\Exception $e) { 21 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 22 | } 23 | } 24 | 25 | 26 | public function sync(Role $role, RolePermissionRequest $request): JsonResponse 27 | { 28 | try { 29 | 30 | $role->savePermissions($request->permissions ?? []); 31 | return response()->json($role->perms, Response::HTTP_OK); 32 | 33 | } catch (\Exception $e) { 34 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Controllers/UsersController.php: -------------------------------------------------------------------------------- 1 | json($resources, Response::HTTP_OK); 20 | 21 | } catch (\Exception $e) { 22 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 23 | } 24 | } 25 | 26 | 27 | public function store(UserRequest $request) 28 | { 29 | return (new RegisterController)->create($request); 30 | } 31 | 32 | 33 | public function show(User $user): JsonResponse 34 | { 35 | return response()->json($user, Response::HTTP_OK); 36 | } 37 | 38 | 39 | public function update(UserRequest $request, User $user): JsonResponse 40 | { 41 | try { 42 | $user->fill($request->all())->save(); 43 | return response()->json($user, Response::HTTP_OK); 44 | 45 | } catch (\Exception $e) { 46 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 47 | } 48 | } 49 | 50 | 51 | public function destroy(User $user): JsonResponse 52 | { 53 | try { 54 | $user->delete(); 55 | return response()->json($user, Response::HTTP_OK); 56 | 57 | } catch (\Exception $e) { 58 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/Http/Controllers/UsersRolesController.php: -------------------------------------------------------------------------------- 1 | roles()->treat($request); 18 | return response()->json($resources); 19 | 20 | } catch (\Exception $e) { 21 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 22 | } 23 | } 24 | 25 | 26 | public function sync(User $user, UserRoleRequest $request): JsonResponse 27 | { 28 | try { 29 | $user->saveRoles($request->roles ?? []); 30 | return response()->json($user->roles, Response::HTTP_OK); 31 | 32 | } catch (\Exception $e) { 33 | return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | 'throttle:60,1', 42 | 'bindings', 43 | ], 44 | ]; 45 | 46 | /** 47 | * The application's route middleware. 48 | * 49 | * These middleware may be assigned to groups or used individually. 50 | * 51 | * @var array 52 | */ 53 | protected $routeMiddleware = [ 54 | 'auth' => \App\Http\Middleware\Authenticate::class, 55 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 56 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 57 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 58 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 59 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 63 | 'role' => \Zizaco\Entrust\Middleware\EntrustRole::class, 64 | 'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class, 65 | 'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class, 66 | ]; 67 | 68 | /** 69 | * The priority-sorted list of middleware. 70 | * 71 | * This forces non-global middleware to always be in the given order. 72 | * 73 | * @var array 74 | */ 75 | protected $middlewarePriority = [ 76 | \Illuminate\Session\Middleware\StartSession::class, 77 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 78 | \App\Http\Middleware\Authenticate::class, 79 | \Illuminate\Session\Middleware\AuthenticateSession::class, 80 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 81 | \Illuminate\Auth\Middleware\Authorize::class, 82 | ]; 83 | } 84 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | builder = $builder; 20 | $this->request = $request; 21 | $this->fillable = $this->builder->getModel()->getFillable(); 22 | $this->fillable = array_merge($this->fillable, ['created_at', 'updated_at', 'id']); 23 | } 24 | 25 | abstract public function apply(); 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/RequestRestFulFilter/OrderBy.php: -------------------------------------------------------------------------------- 1 | request->sort)) { 13 | 14 | $columns = $this->columnsStringToArray($this->request->sort); 15 | 16 | foreach ($columns as $column) { 17 | 18 | $columnName = $this->getColumnName($column); 19 | $orderBy = $this->getOrderByColumnName($column); 20 | 21 | if (in_array($columnName, $this->fillable)) { 22 | $this->builder->orderBy($columnName, $orderBy); 23 | } 24 | } 25 | } 26 | } 27 | 28 | 29 | private function columnsStringToArray(string $columns) 30 | { 31 | return explode(',', $columns); 32 | } 33 | 34 | 35 | private function getFirstLetter(string $string) 36 | { 37 | return substr($string,0,1); 38 | } 39 | 40 | 41 | private function getColumnName(string $column) 42 | { 43 | $firstLetter = $this->getFirstLetter($column); 44 | 45 | return (in_array($firstLetter, ['-', '+'])) 46 | ? substr($column,1) 47 | : $column; 48 | } 49 | 50 | 51 | private function getOrderByColumnName(string $column) 52 | { 53 | $firstLetter = $this->getFirstLetter($column); 54 | 55 | return ($firstLetter === '-') ? 'desc' : 'asc'; 56 | } 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/Http/RequestRestFulFilter/Paginate.php: -------------------------------------------------------------------------------- 1 | request->per_page)) { 14 | $this->request->per_page = env('PAGINATE_PER_PAGE'); 15 | } 16 | 17 | if ($this->request->per_page === 'all') { 18 | $this->resources = ['data' => $this->builder->get()]; 19 | 20 | } else { 21 | $per_page = ((int) $this->request->per_page) ?: config('app.paginate.per_page'); 22 | $this->resources = $this->builder->paginate($per_page); 23 | $this->resources->appends($this->request->all()); 24 | } 25 | } 26 | 27 | 28 | public function applyAndGetResources() 29 | { 30 | $this->apply(); 31 | return $this->resources; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/Http/RequestRestFulFilter/Select.php: -------------------------------------------------------------------------------- 1 | request->fields)) { 13 | $fieldsSelect = explode(',', $this->request->fields); 14 | 15 | if ($fieldsSelect = array_map('trim', $fieldsSelect)) { 16 | $this->builder->select($fieldsSelect); 17 | } 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/RequestRestFulFilter/Where.php: -------------------------------------------------------------------------------- 1 | fieldsSearch = array_intersect_key($this->request->all(), array_flip($this->fillable)); 19 | 20 | $this 21 | ->applyEq() 22 | ->applyLt() 23 | ->applyLte() 24 | ->applyGt() 25 | ->applyGte() 26 | ->applyLike() 27 | ->applyRegex(); 28 | } 29 | 30 | 31 | /** 32 | * Aplica os filtros usando = 33 | * @return Where 34 | */ 35 | private function applyEq(): self 36 | { 37 | 38 | foreach($this->fieldsSearch as $column => $field) { 39 | 40 | if (!is_array($field) || !empty($field['eq'])) { 41 | $valueSearch = ($field['eq']) ?? $field; 42 | $this->builder->where($column,'=', $valueSearch); 43 | } 44 | } 45 | 46 | return $this; 47 | } 48 | 49 | 50 | /** 51 | * Aplica os filtros usando < 52 | * @return Where 53 | */ 54 | private function applyLt(): self 55 | { 56 | foreach($this->fieldsSearch as $column => $field) { 57 | if (!empty($field['lt']) || !empty($field['before']) ) { 58 | $valueSearch = ($field['lt']) ?? $field['before']; 59 | $this->builder->where($column, '<', $valueSearch); 60 | } 61 | } 62 | 63 | return $this; 64 | } 65 | 66 | 67 | /** 68 | * Aplica os filtros usando <= 69 | * @return Where 70 | */ 71 | private function applyLte(): self 72 | { 73 | foreach($this->fieldsSearch as $column => $field) { 74 | if (!empty($field['lte'])) { 75 | $valueSearch = $field['lte']; 76 | $this->builder->where($column,'<=', $valueSearch); 77 | } 78 | } 79 | 80 | return $this; 81 | } 82 | 83 | 84 | /** 85 | * Aplica os filtros usando > 86 | * @return Where 87 | */ 88 | private function applyGt(): self 89 | { 90 | foreach($this->fieldsSearch as $column => $field) { 91 | if (!empty($field['gt']) || !empty($field['after']) ) { 92 | $valueSearch = ($field['gt']) ?? $field['after']; 93 | $this->builder->where($column, '>', $valueSearch); 94 | } 95 | } 96 | 97 | return $this; 98 | } 99 | 100 | 101 | /** 102 | * Aplica os filtros usando >= 103 | * @return Where 104 | */ 105 | private function applyGte(): self 106 | { 107 | foreach($this->fieldsSearch as $column => $field) { 108 | if (!empty($field['gte'])) { 109 | $valueSearch = $field['gte']; 110 | $this->builder->where($column,'>=', $valueSearch); 111 | } 112 | } 113 | 114 | return $this; 115 | } 116 | 117 | 118 | /** 119 | * Aplica os filtros usando like 120 | * @return Where 121 | */ 122 | private function applyLike(): self 123 | { 124 | foreach($this->fieldsSearch as $column => $field) { 125 | 126 | if (!empty($field['like'])) { 127 | $valueSearch = $field['like']; 128 | $this->builder->where($column,'like',"%{$valueSearch}%"); 129 | } 130 | } 131 | 132 | return $this; 133 | } 134 | 135 | /** 136 | * Aplica o filtros de regex 137 | * @return Where 138 | */ 139 | private function applyRegex(): self 140 | { 141 | foreach($this->fieldsSearch as $column => $field) { 142 | 143 | if (!empty($field['regex'])) { 144 | $valueSearch = $field['regex']; 145 | $this->builder->where($column,'regexp', $valueSearch); 146 | } 147 | } 148 | 149 | return $this; 150 | } 151 | 152 | 153 | } 154 | -------------------------------------------------------------------------------- /app/Http/Requests/BaseRequest.php: -------------------------------------------------------------------------------- 1 | getMethod(), ['POST', 'PUT']); 32 | } 33 | 34 | /** 35 | * Check request methos is not Put or Patch 36 | * @return bool 37 | */ 38 | public function methodIsPutOrPatch(): bool 39 | { 40 | return in_array($this->getMethod(), ['PUT', 'PATCH']); 41 | } 42 | 43 | /** 44 | * Let all roles as required 45 | * @param array $rules 46 | * @param array $excepts 47 | */ 48 | public function applyRequiredInRules(array &$rules, array $excepts = []): void 49 | { 50 | array_walk($rules, function(&$rule, $key, $excepts) { 51 | 52 | if (is_string($rule) && !in_array($key, $excepts)) { 53 | $rule = 'required|' . $rule; 54 | 55 | } elseif (is_array($rule) && !in_array($key, $excepts)) { 56 | array_unshift($rule, 'required'); 57 | 58 | } elseif (is_object($rule) && !in_array($key, $excepts)) { 59 | $rule = ['required', $rule]; 60 | 61 | } 62 | 63 | }, $excepts); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/Http/Requests/PermissionRequest.php: -------------------------------------------------------------------------------- 1 | 'string|max:254|regex:/^[a-zA-Z\_\.]+$/u|unique:permissions,name', 18 | 'display_name' => 'string|max:254', 19 | 'description' => 'string|max:254', 20 | ]; 21 | 22 | 23 | if ($this->methodIsPostOrPut()) { 24 | $this->applyRequiredInRules($rules, ['display_name', 'description']); 25 | } 26 | 27 | 28 | if ($this->methodIsPutOrPatch() && !empty($this->permission->id)) { 29 | $rules['name'] .= ',' . $this->permission->id; 30 | } 31 | 32 | return $rules; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/RecoveryRequest.php: -------------------------------------------------------------------------------- 1 | 'required|url', 18 | ]; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Requests/RecoveryUpdatePasswordRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string|between:6,20', 18 | ]; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Requests/RolePermissionRequest.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'required', 19 | 'array', 20 | ], 21 | 'permissions.*' => [ 22 | 'integer', 23 | Rule::exists('permissions', 'id'), 24 | ], 25 | ]; 26 | 27 | return $rules; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/RoleRequest.php: -------------------------------------------------------------------------------- 1 | 'string|max:254|regex:/^[a-zA-Z\_\.]+$/u|unique:roles,name', 18 | 'display_name' => 'string|max:254', 19 | 'description' => 'string|max:254', 20 | ]; 21 | 22 | 23 | if ($this->methodIsPostOrPut()) { 24 | $this->applyRequiredInRules($rules, ['display_name', 'description']); 25 | } 26 | 27 | 28 | if ($this->methodIsPutOrPatch() && !empty($this->role->id)) { 29 | $rules['name'] .= ',' . $this->role->id; 30 | } 31 | 32 | return $rules; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/UserRequest.php: -------------------------------------------------------------------------------- 1 | 'string|max:254', 18 | 'email' => 'email|unique:users,email', 19 | 'phone' => 'regex:/^[\+0-9]+$/|unique:users,phone', 20 | 'password' => 'string|between:6,20', 21 | ]; 22 | 23 | if ($this->methodIsPostOrPut()) { 24 | $this->applyRequiredInRules($rules); 25 | } 26 | 27 | 28 | if ($this->methodIsPutOrPatch() && !empty($this->user->id)) { 29 | $rules['email'] .= ',' . $this->user->id; 30 | $rules['phone'] .= ',' . $this->user->id; 31 | } 32 | 33 | return $rules; 34 | } 35 | 36 | 37 | public function messages() 38 | { 39 | return [ 40 | 'phone.regex' => 'The phone must be a number.', 41 | ]; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/Http/Requests/UserRoleRequest.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'required', 19 | 'array', 20 | ], 21 | 'roles.*' => [ 22 | 'integer', 23 | Rule::exists('roles', 'id'), 24 | ], 25 | ]; 26 | 27 | return $rules; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/Models/Auth/Permission.php: -------------------------------------------------------------------------------- 1 | table = config('entrust.permissions_table'); 28 | } 29 | 30 | public function scopeByName(Builder $builder, string $name) 31 | { 32 | return $builder 33 | ->where($this->table . '.name', $name) 34 | ->firstOrFail(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Models/Auth/Role.php: -------------------------------------------------------------------------------- 1 | table = config('entrust.roles_table'); 28 | } 29 | 30 | 31 | public function scopeByName(Builder $builder, string $name) 32 | { 33 | return $builder 34 | ->where($this->table . '.name', $name) 35 | ->firstOrFail(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Models/Auth/User.php: -------------------------------------------------------------------------------- 1 | 'datetime', 38 | ]; 39 | 40 | public function getJWTIdentifier() 41 | { 42 | return $this->getKey(); 43 | } 44 | 45 | public function getJWTCustomClaims(): array 46 | { 47 | return []; 48 | } 49 | 50 | public function scopeByEmail($builder, string $email) 51 | { 52 | return $builder->where($this->table . ".email", $email); 53 | } 54 | 55 | public function scopeByPhone($builder, string $phone) 56 | { 57 | return $builder->where($this->table . ".phone", $phone); 58 | } 59 | 60 | public function getFirstNameAttribute(): string 61 | { 62 | return explode(' ', $this->name)[0]; 63 | } 64 | 65 | public function setPasswordAttribute(string $value): void 66 | { 67 | $this->attributes['password'] = Hash::make($value); 68 | } 69 | 70 | public function saveRoles($inputRoles) 71 | { 72 | if (!empty($inputRoles)) { 73 | $this->roles()->sync($inputRoles); 74 | } else { 75 | $this->roles()->detach(); 76 | } 77 | 78 | if (Cache::getStore() instanceof TaggableStore) { 79 | Cache::tags(config('entrust.role_user_table'))->flush(); 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/Models/BaseModel.php: -------------------------------------------------------------------------------- 1 | url = $url; 20 | } 21 | 22 | 23 | public function via($notifiable) 24 | { 25 | return ['mail']; 26 | } 27 | 28 | 29 | public function toMail($notifiable) 30 | { 31 | $url = $this->url; 32 | 33 | return (new MailMessage) 34 | ->subject('Account Recovery') 35 | ->view('emails.account_recovery', compact('url')); 36 | } 37 | 38 | 39 | public function toArray($notifiable) 40 | { 41 | return [ 42 | // 43 | ]; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/Notifications/SendEmailVerification.php: -------------------------------------------------------------------------------- 1 | make_url($notifiable); 31 | 32 | return (new MailMessage) 33 | ->subject('Account Verification') 34 | ->view('emails.account_verification', compact('url')); 35 | } 36 | 37 | 38 | public function toArray($notifiable) 39 | { 40 | return [ 41 | // 42 | ]; 43 | } 44 | 45 | 46 | private function make_url($notifiable) 47 | { 48 | return URL::temporarySignedRoute( 49 | 'register.verification', 50 | now()->addMinutes(config('auth.verification.expire')), 51 | ['user' => $notifiable->email] 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.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 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::middleware('api') 69 | ->namespace($this->namespace) 70 | ->group(base_path('routes/api.php')); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/Scopes/OwnerScope.php: -------------------------------------------------------------------------------- 1 | getFillable())) { 19 | $builder->where('user_id', auth()->user()->id); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Traits/Treat.php: -------------------------------------------------------------------------------- 1 | apply(); 22 | $where->apply(); 23 | $orderBy->apply(); 24 | 25 | return $paginate->applyAndGetResources(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "medeirosdev/laravelmicroservices", 3 | "type": "project", 4 | "description": "Microservice - User", 5 | "keywords": [ 6 | "project", 7 | "medeirosdev", 8 | "microservice", 9 | "users" 10 | ], 11 | "license": "MIT", 12 | "require": { 13 | "php": "^7.3", 14 | "barryvdh/laravel-ide-helper": "^2.6", 15 | "fideloper/proxy": "^4.0", 16 | "laravel/framework": "5.8.*", 17 | "laravel/tinker": "^1.0", 18 | "predis/predis": "^1.1", 19 | "tymon/jwt-auth": "1.0.*", 20 | "zizaco/entrust": "dev-master" 21 | }, 22 | "require-dev": { 23 | "beyondcode/laravel-dump-server": "^1.0", 24 | "filp/whoops": "^2.0", 25 | "fzaninotto/faker": "^1.4", 26 | "mockery/mockery": "^1.0", 27 | "nunomaduro/collision": "^3.0", 28 | "phpunit/phpunit": "^7.5" 29 | }, 30 | "config": { 31 | "optimize-autoloader": true, 32 | "preferred-install": "dist", 33 | "sort-packages": true 34 | }, 35 | "extra": { 36 | "laravel": { 37 | "dont-discover": [] 38 | } 39 | }, 40 | "autoload": { 41 | "psr-4": { 42 | "App\\": "app/" 43 | }, 44 | "classmap": [ 45 | "database/seeds", 46 | "database/factories" 47 | ] 48 | }, 49 | "autoload-dev": { 50 | "psr-4": { 51 | "Tests\\": "tests/" 52 | } 53 | }, 54 | "minimum-stability": "dev", 55 | "prefer-stable": true, 56 | "scripts": { 57 | "post-autoload-dump": [ 58 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 59 | "@php artisan package:discover --ansi" 60 | ], 61 | "post-root-package-install": [ 62 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 63 | ], 64 | "post-create-project-cmd": [ 65 | "@php artisan key:generate --ansi" 66 | ] 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'Laravel'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application Environment 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This value determines the "environment" your application is currently 24 | | running in. This may determine how you prefer to configure various 25 | | services the application utilizes. Set this in your ".env" file. 26 | | 27 | */ 28 | 29 | 'env' => env('APP_ENV', 'production'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application Debug Mode 34 | |-------------------------------------------------------------------------- 35 | | 36 | | When your application is in debug mode, detailed error messages with 37 | | stack traces will be shown on every error that occurs within your 38 | | application. If disabled, a simple generic error page is shown. 39 | | 40 | */ 41 | 42 | 'debug' => env('APP_DEBUG', false), 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application URL 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This URL is used by the console to properly generate URLs when using 50 | | the Artisan command line tool. You should set this to the root of 51 | | your application so that it is used when running Artisan tasks. 52 | | 53 | */ 54 | 55 | 'url' => env('APP_URL', 'http://localhost'), 56 | 57 | 'asset_url' => env('ASSET_URL', null), 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Application Timezone 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the default timezone for your application, which 65 | | will be used by the PHP date and date-time functions. We have gone 66 | | ahead and set this to a sensible default for you out of the box. 67 | | 68 | */ 69 | 70 | 'timezone' => 'UTC', 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | Application Locale Configuration 75 | |-------------------------------------------------------------------------- 76 | | 77 | | The application locale determines the default locale that will be used 78 | | by the translation service provider. You are free to set this value 79 | | to any of the locales which will be supported by the application. 80 | | 81 | */ 82 | 83 | 'locale' => 'en', 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Application Fallback Locale 88 | |-------------------------------------------------------------------------- 89 | | 90 | | The fallback locale determines the locale to use when the current one 91 | | is not available. You may change the value to correspond to any of 92 | | the language folders that are provided through your application. 93 | | 94 | */ 95 | 96 | 'fallback_locale' => 'en', 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Faker Locale 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This locale will be used by the Faker PHP library when generating fake 104 | | data for your database seeds. For example, this will be used to get 105 | | localized telephone numbers, street address information and more. 106 | | 107 | */ 108 | 109 | 'faker_locale' => 'en_US', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Encryption Key 114 | |-------------------------------------------------------------------------- 115 | | 116 | | This key is used by the Illuminate encrypter service and should be set 117 | | to a random, 32 character string, otherwise these encrypted strings 118 | | will not be safe. Please do this before deploying an application! 119 | | 120 | */ 121 | 122 | 'key' => env('APP_KEY'), 123 | 124 | 'cipher' => 'AES-256-CBC', 125 | 126 | 'paginate' => [ 127 | 'per_page' => env('PAGINATE_PER_PAGE', 15), 128 | ], 129 | 130 | /* 131 | |-------------------------------------------------------------------------- 132 | | Autoloaded Service Providers 133 | |-------------------------------------------------------------------------- 134 | | 135 | | The service providers listed here will be automatically loaded on the 136 | | request to your application. Feel free to add your own services to 137 | | this array to grant expanded functionality to your applications. 138 | | 139 | */ 140 | 141 | 'providers' => [ 142 | 143 | /* 144 | * Laravel Framework Service Providers... 145 | */ 146 | Illuminate\Auth\AuthServiceProvider::class, 147 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 148 | Illuminate\Bus\BusServiceProvider::class, 149 | Illuminate\Cache\CacheServiceProvider::class, 150 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 151 | Illuminate\Cookie\CookieServiceProvider::class, 152 | Illuminate\Database\DatabaseServiceProvider::class, 153 | Illuminate\Encryption\EncryptionServiceProvider::class, 154 | Illuminate\Filesystem\FilesystemServiceProvider::class, 155 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 156 | Illuminate\Hashing\HashServiceProvider::class, 157 | Illuminate\Mail\MailServiceProvider::class, 158 | Illuminate\Notifications\NotificationServiceProvider::class, 159 | Illuminate\Pagination\PaginationServiceProvider::class, 160 | Illuminate\Pipeline\PipelineServiceProvider::class, 161 | Illuminate\Queue\QueueServiceProvider::class, 162 | Illuminate\Redis\RedisServiceProvider::class, 163 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 164 | Illuminate\Session\SessionServiceProvider::class, 165 | Illuminate\Translation\TranslationServiceProvider::class, 166 | Illuminate\Validation\ValidationServiceProvider::class, 167 | Illuminate\View\ViewServiceProvider::class, 168 | 169 | /* 170 | * Package Service Providers... 171 | */ 172 | 173 | /* 174 | * Application Service Providers... 175 | */ 176 | App\Providers\AppServiceProvider::class, 177 | App\Providers\AuthServiceProvider::class, 178 | // App\Providers\BroadcastServiceProvider::class, 179 | App\Providers\EventServiceProvider::class, 180 | App\Providers\RouteServiceProvider::class, 181 | 182 | Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class, 183 | 184 | Zizaco\Entrust\EntrustServiceProvider::class, 185 | 186 | ], 187 | 188 | /* 189 | |-------------------------------------------------------------------------- 190 | | Class Aliases 191 | |-------------------------------------------------------------------------- 192 | | 193 | | This array of class aliases will be registered when this application 194 | | is started. However, feel free to register as many as you wish as 195 | | the aliases are "lazy" loaded so they don't hinder performance. 196 | | 197 | */ 198 | 199 | 'aliases' => [ 200 | 201 | 'App' => Illuminate\Support\Facades\App::class, 202 | 'Arr' => Illuminate\Support\Arr::class, 203 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 204 | 'Auth' => Illuminate\Support\Facades\Auth::class, 205 | 'Blade' => Illuminate\Support\Facades\Blade::class, 206 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 207 | 'Bus' => Illuminate\Support\Facades\Bus::class, 208 | 'Cache' => Illuminate\Support\Facades\Cache::class, 209 | 'Config' => Illuminate\Support\Facades\Config::class, 210 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 211 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 212 | 'DB' => Illuminate\Support\Facades\DB::class, 213 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 214 | 'Event' => Illuminate\Support\Facades\Event::class, 215 | 'File' => Illuminate\Support\Facades\File::class, 216 | 'Gate' => Illuminate\Support\Facades\Gate::class, 217 | 'Hash' => Illuminate\Support\Facades\Hash::class, 218 | 'Lang' => Illuminate\Support\Facades\Lang::class, 219 | 'Log' => Illuminate\Support\Facades\Log::class, 220 | 'Mail' => Illuminate\Support\Facades\Mail::class, 221 | 'Notification' => Illuminate\Support\Facades\Notification::class, 222 | 'Password' => Illuminate\Support\Facades\Password::class, 223 | 'Queue' => Illuminate\Support\Facades\Queue::class, 224 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 225 | 'Redis' => Illuminate\Support\Facades\Redis::class, 226 | 'Request' => Illuminate\Support\Facades\Request::class, 227 | 'Response' => Illuminate\Support\Facades\Response::class, 228 | 'Route' => Illuminate\Support\Facades\Route::class, 229 | 'Schema' => Illuminate\Support\Facades\Schema::class, 230 | 'Session' => Illuminate\Support\Facades\Session::class, 231 | 'Storage' => Illuminate\Support\Facades\Storage::class, 232 | 'Str' => Illuminate\Support\Str::class, 233 | 'URL' => Illuminate\Support\Facades\URL::class, 234 | 'Validator' => Illuminate\Support\Facades\Validator::class, 235 | 'View' => Illuminate\Support\Facades\View::class, 236 | 237 | 238 | 'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class, 239 | 'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class, 240 | 241 | 'Entrust' => Zizaco\Entrust\EntrustFacade::class, 242 | ], 243 | 244 | ]; 245 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'api', 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' => 'jwt', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\Models\Auth\User::class, 71 | 'table' => 'users', 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 | ], 101 | ], 102 | 103 | 'verification' => [ 104 | 'expire' => env('AUTH_VERIFICATION_EXPIRE', 60), 105 | ] 106 | 107 | ]; 108 | -------------------------------------------------------------------------------- /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 | 'encrypted' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Cache Stores 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may define all of the cache "stores" for your application as 29 | | well as their drivers. You may even define multiple stores for the 30 | | same cache driver to group types of items stored in your caches. 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | ], 43 | 44 | 'database' => [ 45 | 'driver' => 'database', 46 | 'table' => 'cache', 47 | 'connection' => null, 48 | ], 49 | 50 | 'file' => [ 51 | 'driver' => 'file', 52 | 'path' => storage_path('framework/cache/data'), 53 | ], 54 | 55 | 'memcached' => [ 56 | 'driver' => 'memcached', 57 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 58 | 'sasl' => [ 59 | env('MEMCACHED_USERNAME'), 60 | env('MEMCACHED_PASSWORD'), 61 | ], 62 | 'options' => [ 63 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 64 | ], 65 | 'servers' => [ 66 | [ 67 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 68 | 'port' => env('MEMCACHED_PORT', 11211), 69 | 'weight' => 100, 70 | ], 71 | ], 72 | ], 73 | 74 | 'redis' => [ 75 | 'driver' => 'redis', 76 | 'connection' => 'cache', 77 | ], 78 | 79 | 'dynamodb' => [ 80 | 'driver' => 'dynamodb', 81 | 'key' => env('AWS_ACCESS_KEY_ID'), 82 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 83 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 84 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 85 | ], 86 | 87 | ], 88 | 89 | /* 90 | |-------------------------------------------------------------------------- 91 | | Cache Key Prefix 92 | |-------------------------------------------------------------------------- 93 | | 94 | | When utilizing a RAM based store such as APC or Memcached, there might 95 | | be other applications utilizing the same cache. So, we'll specify a 96 | | value to get prefixed to all our keys so we can avoid collisions. 97 | | 98 | */ 99 | 100 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /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', 'predis'), 123 | 124 | 'options' => [ 125 | 'cluster' => env('REDIS_CLUSTER', 'predis'), 126 | 'prefix' => Str::slug(env('APP_NAME', 'laravel'), '_').'_database_', 127 | ], 128 | 129 | 'default' => [ 130 | 'host' => env('REDIS_HOST', '127.0.0.1'), 131 | 'password' => env('REDIS_PASSWORD', null), 132 | 'port' => env('REDIS_PORT', 6379), 133 | 'database' => env('REDIS_DB', 0), 134 | ], 135 | 136 | 'cache' => [ 137 | 'host' => env('REDIS_HOST', '127.0.0.1'), 138 | 'password' => env('REDIS_PASSWORD', null), 139 | 'port' => env('REDIS_PORT', 6379), 140 | 'database' => env('REDIS_CACHE_DB', 1), 141 | ], 142 | 143 | ], 144 | 145 | ]; 146 | -------------------------------------------------------------------------------- /config/entrust.php: -------------------------------------------------------------------------------- 1 | 'App\Models\Auth\Role', 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Entrust Roles Table 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This is the roles table used by Entrust to save roles to the database. 30 | | 31 | */ 32 | 'roles_table' => 'roles', 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Entrust Permission Model 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the Permission model used by Entrust to create correct relations. 40 | | Update the permission if it is in a different namespace. 41 | | 42 | */ 43 | 'permission' => 'App\Models\Auth\Permission', 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | Entrust Permissions Table 48 | |-------------------------------------------------------------------------- 49 | | 50 | | This is the permissions table used by Entrust to save permissions to the 51 | | database. 52 | | 53 | */ 54 | 'permissions_table' => 'permissions', 55 | 56 | /* 57 | |-------------------------------------------------------------------------- 58 | | Entrust permission_role Table 59 | |-------------------------------------------------------------------------- 60 | | 61 | | This is the permission_role table used by Entrust to save relationship 62 | | between permissions and roles to the database. 63 | | 64 | */ 65 | 'permission_role_table' => 'permission_role', 66 | 67 | /* 68 | |-------------------------------------------------------------------------- 69 | | Entrust role_user Table 70 | |-------------------------------------------------------------------------- 71 | | 72 | | This is the role_user table used by Entrust to save assigned roles to the 73 | | database. 74 | | 75 | */ 76 | 'role_user_table' => 'role_user', 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | User Foreign key on Entrust's role_user Table (Pivot) 81 | |-------------------------------------------------------------------------- 82 | */ 83 | 'user_foreign_key' => 'user_id', 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Role Foreign key on Entrust's role_user Table (Pivot) 88 | |-------------------------------------------------------------------------- 89 | */ 90 | 'role_foreign_key' => 'role_id', 91 | 92 | ]; 93 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'argon', 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 | -------------------------------------------------------------------------------- /config/jwt.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 14 | /* 15 | |-------------------------------------------------------------------------- 16 | | JWT Authentication Secret 17 | |-------------------------------------------------------------------------- 18 | | 19 | | Don't forget to set this in your .env file, as it will be used to sign 20 | | your tokens. A helper command is provided for this: 21 | | `php artisan jwt:secret` 22 | | 23 | | Note: This will be used for Symmetric algorithms only (HMAC), 24 | | since RSA and ECDSA use a private/public key combo (See below). 25 | | 26 | */ 27 | 28 | 'secret' => env('JWT_SECRET'), 29 | 30 | /* 31 | |-------------------------------------------------------------------------- 32 | | JWT Authentication Keys 33 | |-------------------------------------------------------------------------- 34 | | 35 | | The algorithm you are using, will determine whether your tokens are 36 | | signed with a random string (defined in `JWT_SECRET`) or using the 37 | | following public & private keys. 38 | | 39 | | Symmetric Algorithms: 40 | | HS256, HS384 & HS512 will use `JWT_SECRET`. 41 | | 42 | | Asymmetric Algorithms: 43 | | RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below. 44 | | 45 | */ 46 | 47 | 'keys' => [ 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Public Key 52 | |-------------------------------------------------------------------------- 53 | | 54 | | A path or resource to your public key. 55 | | 56 | | E.g. 'file://path/to/public/key' 57 | | 58 | */ 59 | 60 | 'public' => env('JWT_PUBLIC_KEY'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Private Key 65 | |-------------------------------------------------------------------------- 66 | | 67 | | A path or resource to your private key. 68 | | 69 | | E.g. 'file://path/to/private/key' 70 | | 71 | */ 72 | 73 | 'private' => env('JWT_PRIVATE_KEY'), 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Passphrase 78 | |-------------------------------------------------------------------------- 79 | | 80 | | The passphrase for your private key. Can be null if none set. 81 | | 82 | */ 83 | 84 | 'passphrase' => env('JWT_PASSPHRASE'), 85 | 86 | ], 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | JWT time to live 91 | |-------------------------------------------------------------------------- 92 | | 93 | | Specify the length of time (in minutes) that the token will be valid for. 94 | | Defaults to 1 hour. 95 | | 96 | | You can also set this to null, to yield a never expiring token. 97 | | Some people may want this behaviour for e.g. a mobile app. 98 | | This is not particularly recommended, so make sure you have appropriate 99 | | systems in place to revoke the token if necessary. 100 | | Notice: If you set this to null you should remove 'exp' element from 'required_claims' list. 101 | | 102 | */ 103 | 104 | 'ttl' => env('JWT_TTL', 60), 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Refresh time to live 109 | |-------------------------------------------------------------------------- 110 | | 111 | | Specify the length of time (in minutes) that the token can be refreshed 112 | | within. I.E. The user can refresh their token within a 2 week window of 113 | | the original token being created until they must re-authenticate. 114 | | Defaults to 2 weeks. 115 | | 116 | | You can also set this to null, to yield an infinite refresh time. 117 | | Some may want this instead of never expiring tokens for e.g. a mobile app. 118 | | This is not particularly recommended, so make sure you have appropriate 119 | | systems in place to revoke the token if necessary. 120 | | 121 | */ 122 | 123 | 'refresh_ttl' => env('JWT_REFRESH_TTL', 20160), 124 | 125 | /* 126 | |-------------------------------------------------------------------------- 127 | | JWT hashing algorithm 128 | |-------------------------------------------------------------------------- 129 | | 130 | | Specify the hashing algorithm that will be used to sign the token. 131 | | 132 | | See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL 133 | | for possible values. 134 | | 135 | */ 136 | 137 | 'algo' => env('JWT_ALGO', 'HS256'), 138 | 139 | /* 140 | |-------------------------------------------------------------------------- 141 | | Required Claims 142 | |-------------------------------------------------------------------------- 143 | | 144 | | Specify the required claims that must exist in any token. 145 | | A TokenInvalidException will be thrown if any of these claims are not 146 | | present in the payload. 147 | | 148 | */ 149 | 150 | 'required_claims' => [ 151 | 'iss', 152 | 'iat', 153 | 'exp', 154 | 'nbf', 155 | 'sub', 156 | 'jti', 157 | ], 158 | 159 | /* 160 | |-------------------------------------------------------------------------- 161 | | Persistent Claims 162 | |-------------------------------------------------------------------------- 163 | | 164 | | Specify the claim keys to be persisted when refreshing a token. 165 | | `sub` and `iat` will automatically be persisted, in 166 | | addition to the these claims. 167 | | 168 | | Note: If a claim does not exist then it will be ignored. 169 | | 170 | */ 171 | 172 | 'persistent_claims' => [ 173 | // 'foo', 174 | // 'bar', 175 | ], 176 | 177 | /* 178 | |-------------------------------------------------------------------------- 179 | | Lock Subject 180 | |-------------------------------------------------------------------------- 181 | | 182 | | This will determine whether a `prv` claim is automatically added to 183 | | the token. The purpose of this is to ensure that if you have multiple 184 | | authentication models e.g. `App\User` & `App\OtherPerson`, then we 185 | | should prevent one authentication request from impersonating another, 186 | | if 2 tokens happen to have the same id across the 2 different models. 187 | | 188 | | Under specific circumstances, you may want to disable this behaviour 189 | | e.g. if you only have one authentication model, then you would save 190 | | a little on token size. 191 | | 192 | */ 193 | 194 | 'lock_subject' => true, 195 | 196 | /* 197 | |-------------------------------------------------------------------------- 198 | | Leeway 199 | |-------------------------------------------------------------------------- 200 | | 201 | | This property gives the jwt timestamp claims some "leeway". 202 | | Meaning that if you have any unavoidable slight clock skew on 203 | | any of your servers then this will afford you some level of cushioning. 204 | | 205 | | This applies to the claims `iat`, `nbf` and `exp`. 206 | | 207 | | Specify in seconds - only if you know you need it. 208 | | 209 | */ 210 | 211 | 'leeway' => env('JWT_LEEWAY', 0), 212 | 213 | /* 214 | |-------------------------------------------------------------------------- 215 | | Blacklist Enabled 216 | |-------------------------------------------------------------------------- 217 | | 218 | | In order to invalidate tokens, you must have the blacklist enabled. 219 | | If you do not want or need this functionality, then set this to false. 220 | | 221 | */ 222 | 223 | 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true), 224 | 225 | /* 226 | | ------------------------------------------------------------------------- 227 | | Blacklist Grace Period 228 | | ------------------------------------------------------------------------- 229 | | 230 | | When multiple concurrent requests are made with the same JWT, 231 | | it is possible that some of them fail, due to token regeneration 232 | | on every request. 233 | | 234 | | Set grace period in seconds to prevent parallel request failure. 235 | | 236 | */ 237 | 238 | 'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0), 239 | 240 | /* 241 | |-------------------------------------------------------------------------- 242 | | Cookies encryption 243 | |-------------------------------------------------------------------------- 244 | | 245 | | By default Laravel encrypt cookies for security reason. 246 | | If you decide to not decrypt cookies, you will have to configure Laravel 247 | | to not encrypt your cookie token by adding its name into the $except 248 | | array available in the middleware "EncryptCookies" provided by Laravel. 249 | | see https://laravel.com/docs/master/responses#cookies-and-encryption 250 | | for details. 251 | | 252 | | Set it to true if you want to decrypt cookies. 253 | | 254 | */ 255 | 256 | 'decrypt_cookies' => false, 257 | 258 | /* 259 | |-------------------------------------------------------------------------- 260 | | Providers 261 | |-------------------------------------------------------------------------- 262 | | 263 | | Specify the various providers used throughout the package. 264 | | 265 | */ 266 | 267 | 'providers' => [ 268 | 269 | /* 270 | |-------------------------------------------------------------------------- 271 | | JWT Provider 272 | |-------------------------------------------------------------------------- 273 | | 274 | | Specify the provider that is used to create and decode the tokens. 275 | | 276 | */ 277 | 278 | 'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class, 279 | 280 | /* 281 | |-------------------------------------------------------------------------- 282 | | Authentication Provider 283 | |-------------------------------------------------------------------------- 284 | | 285 | | Specify the provider that is used to authenticate users. 286 | | 287 | */ 288 | 289 | 'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class, 290 | 291 | /* 292 | |-------------------------------------------------------------------------- 293 | | Storage Provider 294 | |-------------------------------------------------------------------------- 295 | | 296 | | Specify the provider that is used to store tokens in the blacklist. 297 | | 298 | */ 299 | 300 | 'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class, 301 | 302 | ], 303 | 304 | ]; 305 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Log Channels 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may configure the log channels for your application. Out of 27 | | the box, Laravel uses the Monolog PHP logging library. This gives 28 | | you a variety of powerful log handlers / formatters to utilize. 29 | | 30 | | Available Drivers: "single", "daily", "slack", "syslog", 31 | | "errorlog", "monolog", 32 | | "custom", "stack" 33 | | 34 | */ 35 | 36 | 'channels' => [ 37 | 'stack' => [ 38 | 'driver' => 'stack', 39 | 'channels' => ['daily'], 40 | 'ignore_exceptions' => false, 41 | ], 42 | 43 | 'single' => [ 44 | 'driver' => 'single', 45 | 'path' => storage_path('logs/laravel.log'), 46 | 'level' => 'debug', 47 | ], 48 | 49 | 'daily' => [ 50 | 'driver' => 'daily', 51 | 'path' => storage_path('logs/laravel.log'), 52 | 'level' => 'debug', 53 | 'days' => 14, 54 | ], 55 | 56 | 'slack' => [ 57 | 'driver' => 'slack', 58 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 59 | 'username' => 'Laravel Log', 60 | 'emoji' => ':boom:', 61 | 'level' => 'critical', 62 | ], 63 | 64 | 'papertrail' => [ 65 | 'driver' => 'monolog', 66 | 'level' => 'debug', 67 | 'handler' => SyslogUdpHandler::class, 68 | 'handler_with' => [ 69 | 'host' => env('PAPERTRAIL_URL'), 70 | 'port' => env('PAPERTRAIL_PORT'), 71 | ], 72 | ], 73 | 74 | 'stderr' => [ 75 | 'driver' => 'monolog', 76 | 'handler' => StreamHandler::class, 77 | 'formatter' => env('LOG_STDERR_FORMATTER'), 78 | 'with' => [ 79 | 'stream' => 'php://stderr', 80 | ], 81 | ], 82 | 83 | 'syslog' => [ 84 | 'driver' => 'syslog', 85 | 'level' => 'debug', 86 | ], 87 | 88 | 'errorlog' => [ 89 | 'driver' => 'errorlog', 90 | 'level' => 'debug', 91 | ], 92 | ], 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => [ 59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 60 | 'name' => env('MAIL_FROM_NAME', 'Example'), 61 | ], 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | E-Mail Encryption Protocol 66 | |-------------------------------------------------------------------------- 67 | | 68 | | Here you may specify the encryption protocol that should be used when 69 | | the application send e-mail messages. A sensible default using the 70 | | transport layer security protocol should provide great security. 71 | | 72 | */ 73 | 74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | SMTP Server Username 79 | |-------------------------------------------------------------------------- 80 | | 81 | | If your SMTP server requires a username for authentication, you should 82 | | set it here. This will get used to authenticate with your server on 83 | | connection. You may also set the "password" value below this one. 84 | | 85 | */ 86 | 87 | 'username' => env('MAIL_USERNAME'), 88 | 89 | 'password' => env('MAIL_PASSWORD'), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Sendmail System Path 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When using the "sendmail" driver to send e-mails, we will need to know 97 | | the path to where Sendmail lives on this server. A default path has 98 | | been provided here, which will work well on most of your systems. 99 | | 100 | */ 101 | 102 | 'sendmail' => '/usr/sbin/sendmail -bs', 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Markdown Mail Settings 107 | |-------------------------------------------------------------------------- 108 | | 109 | | If you are using Markdown based email rendering, you may configure your 110 | | theme and component paths here, allowing you to customize the design 111 | | of the emails. Or, you may simply stick with the Laravel defaults! 112 | | 113 | */ 114 | 115 | 'markdown' => [ 116 | 'theme' => 'default', 117 | 118 | 'paths' => [ 119 | resource_path('views/vendor/mail'), 120 | ], 121 | ], 122 | 123 | /* 124 | |-------------------------------------------------------------------------- 125 | | Log Channel 126 | |-------------------------------------------------------------------------- 127 | | 128 | | If you are using the "log" driver, you may specify the logging channel 129 | | if you prefer to keep mail messages separate from other log entries 130 | | for simpler reading. Otherwise, the default channel will be used. 131 | | 132 | */ 133 | 134 | 'log_channel' => env('MAIL_LOG_CHANNEL'), 135 | 136 | ]; 137 | -------------------------------------------------------------------------------- /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 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | 'block_for' => 0, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => env('AWS_ACCESS_KEY_ID'), 55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 58 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 59 | ], 60 | 61 | 'redis' => [ 62 | 'driver' => 'redis', 63 | 'connection' => 'default', 64 | 'queue' => env('REDIS_QUEUE', 'default'), 65 | 'retry_after' => 90, 66 | 'block_for' => null, 67 | ], 68 | 69 | ], 70 | 71 | /* 72 | |-------------------------------------------------------------------------- 73 | | Failed Queue Jobs 74 | |-------------------------------------------------------------------------- 75 | | 76 | | These options configure the behavior of failed queue job logging so you 77 | | can control which database and table are used to store the jobs that 78 | | have failed. You may change them to any database / table you wish. 79 | | 80 | */ 81 | 82 | 'failed' => [ 83 | 'database' => env('DB_CONNECTION', 'mysql'), 84 | 'table' => 'failed_jobs', 85 | ], 86 | 87 | ]; 88 | -------------------------------------------------------------------------------- /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 | 'sparkpost' => [ 34 | 'secret' => env('SPARKPOST_SECRET'), 35 | ], 36 | 37 | 'stripe' => [ 38 | 'model' => App\Models\User::class, 39 | 'key' => env('STRIPE_KEY'), 40 | 'secret' => env('STRIPE_SECRET'), 41 | 'webhook' => [ 42 | 'secret' => env('STRIPE_WEBHOOK_SECRET'), 43 | 'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300), 44 | ], 45 | ], 46 | 47 | ]; 48 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Session Lifetime 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may specify the number of minutes that you wish the session 29 | | to be allowed to remain idle before it expires. If you want them 30 | | to immediately expire on the browser closing, set that option. 31 | | 32 | */ 33 | 34 | 'lifetime' => env('SESSION_LIFETIME', 120), 35 | 36 | 'expire_on_close' => false, 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Session Encryption 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This option allows you to easily specify that all of your session data 44 | | should be encrypted before it is stored. All encryption will be run 45 | | automatically by Laravel and you can use the Session like normal. 46 | | 47 | */ 48 | 49 | 'encrypt' => false, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Session File Location 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When using the native session driver, we need a location where session 57 | | files may be stored. A default has been set for you but a different 58 | | location may be specified. This is only needed for file sessions. 59 | | 60 | */ 61 | 62 | 'files' => storage_path('framework/sessions'), 63 | 64 | /* 65 | |-------------------------------------------------------------------------- 66 | | Session Database Connection 67 | |-------------------------------------------------------------------------- 68 | | 69 | | When using the "database" or "redis" session drivers, you may specify a 70 | | connection that should be used to manage these sessions. This should 71 | | correspond to a connection in your database configuration options. 72 | | 73 | */ 74 | 75 | 'connection' => env('SESSION_CONNECTION', null), 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Session Database Table 80 | |-------------------------------------------------------------------------- 81 | | 82 | | When using the "database" session driver, you may specify the table we 83 | | should use to manage the sessions. Of course, a sensible default is 84 | | provided for you; however, you are free to change this as needed. 85 | | 86 | */ 87 | 88 | 'table' => 'sessions', 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Session Cache Store 93 | |-------------------------------------------------------------------------- 94 | | 95 | | When using the "apc", "memcached", or "dynamodb" session drivers you may 96 | | list a cache store that should be used for these sessions. This value 97 | | must match with one of the application's configured cache "stores". 98 | | 99 | */ 100 | 101 | 'store' => env('SESSION_STORE', null), 102 | 103 | /* 104 | |-------------------------------------------------------------------------- 105 | | Session Sweeping Lottery 106 | |-------------------------------------------------------------------------- 107 | | 108 | | Some session drivers must manually sweep their storage location to get 109 | | rid of old sessions from storage. Here are the chances that it will 110 | | happen on a given request. By default, the odds are 2 out of 100. 111 | | 112 | */ 113 | 114 | 'lottery' => [2, 100], 115 | 116 | /* 117 | |-------------------------------------------------------------------------- 118 | | Session Cookie Name 119 | |-------------------------------------------------------------------------- 120 | | 121 | | Here you may change the name of the cookie used to identify a session 122 | | instance by ID. The name specified here will get used every time a 123 | | new session cookie is created by the framework for every driver. 124 | | 125 | */ 126 | 127 | 'cookie' => env( 128 | 'SESSION_COOKIE', 129 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session' 130 | ), 131 | 132 | /* 133 | |-------------------------------------------------------------------------- 134 | | Session Cookie Path 135 | |-------------------------------------------------------------------------- 136 | | 137 | | The session cookie path determines the path for which the cookie will 138 | | be regarded as available. Typically, this will be the root path of 139 | | your application but you are free to change this when necessary. 140 | | 141 | */ 142 | 143 | 'path' => '/', 144 | 145 | /* 146 | |-------------------------------------------------------------------------- 147 | | Session Cookie Domain 148 | |-------------------------------------------------------------------------- 149 | | 150 | | Here you may change the domain of the cookie used to identify a session 151 | | in your application. This will determine which domains the cookie is 152 | | available to in your application. A sensible default has been set. 153 | | 154 | */ 155 | 156 | 'domain' => env('SESSION_DOMAIN', null), 157 | 158 | /* 159 | |-------------------------------------------------------------------------- 160 | | HTTPS Only Cookies 161 | |-------------------------------------------------------------------------- 162 | | 163 | | By setting this option to true, session cookies will only be sent back 164 | | to the server if the browser has a HTTPS connection. This will keep 165 | | the cookie from being sent to you if it can not be done securely. 166 | | 167 | */ 168 | 169 | 'secure' => env('SESSION_SECURE_COOKIE', false), 170 | 171 | /* 172 | |-------------------------------------------------------------------------- 173 | | HTTP Access Only 174 | |-------------------------------------------------------------------------- 175 | | 176 | | Setting this value to true will prevent JavaScript from accessing the 177 | | value of the cookie and the cookie will only be accessible through 178 | | the HTTP protocol. You are free to modify this option if needed. 179 | | 180 | */ 181 | 182 | 'http_only' => true, 183 | 184 | /* 185 | |-------------------------------------------------------------------------- 186 | | Same-Site Cookies 187 | |-------------------------------------------------------------------------- 188 | | 189 | | This option determines how your cookies behave when cross-site requests 190 | | take place, and can be used to mitigate CSRF attacks. By default, we 191 | | do not enable this as other CSRF protection services are in place. 192 | | 193 | | Supported: "lax", "strict" 194 | | 195 | */ 196 | 197 | 'same_site' => null, 198 | 199 | ]; 200 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | *.sqlite-journal 3 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(User::class, function (Faker $faker) { 20 | return [ 21 | 'name' => $faker->name, 22 | 'email' => $faker->unique()->safeEmail, 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | }); 28 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name', '254'); 19 | $table->string('email', '254')->unique(); 20 | $table->string('phone', '30')->unique(); 21 | $table->string('password'); 22 | $table->timestamp('email_verified_at')->nullable(); 23 | $table->rememberToken(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('users'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /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/2019_06_17_123029_entrust_setup_tables.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->string('name')->unique(); 20 | $table->string('display_name')->nullable(); 21 | $table->string('description')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | 25 | // Create table for associating roles to users (Many-to-Many) 26 | Schema::create('role_user', function (Blueprint $table) { 27 | $table->integer('user_id')->unsigned(); 28 | $table->integer('role_id')->unsigned(); 29 | 30 | $table->foreign('user_id')->references('id')->on('users') 31 | ->onUpdate('cascade')->onDelete('cascade'); 32 | $table->foreign('role_id')->references('id')->on('roles') 33 | ->onUpdate('cascade')->onDelete('cascade'); 34 | 35 | $table->primary(['user_id', 'role_id']); 36 | }); 37 | 38 | // Create table for storing permissions 39 | Schema::create('permissions', function (Blueprint $table) { 40 | $table->increments('id'); 41 | $table->string('name')->unique(); 42 | $table->string('display_name')->nullable(); 43 | $table->string('description')->nullable(); 44 | $table->timestamps(); 45 | }); 46 | 47 | // Create table for associating permissions to roles (Many-to-Many) 48 | Schema::create('permission_role', function (Blueprint $table) { 49 | $table->integer('permission_id')->unsigned(); 50 | $table->integer('role_id')->unsigned(); 51 | 52 | $table->foreign('permission_id')->references('id')->on('permissions') 53 | ->onUpdate('cascade')->onDelete('cascade'); 54 | $table->foreign('role_id')->references('id')->on('roles') 55 | ->onUpdate('cascade')->onDelete('cascade'); 56 | 57 | $table->primary(['permission_id', 'role_id']); 58 | }); 59 | 60 | DB::commit(); 61 | } 62 | 63 | /** 64 | * Reverse the migrations. 65 | * 66 | * @return void 67 | */ 68 | public function down() 69 | { 70 | Schema::drop('permission_role'); 71 | Schema::drop('permissions'); 72 | Schema::drop('role_user'); 73 | Schema::drop('roles'); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | $this->call(RolesTableSeeder::class); 16 | $this->call(PermissionsTableSeeder::class); 17 | $this->call(PermissionRoleTableSeeder::class); 18 | $this->call(RoleUserTableSeeder::class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /database/seeds/PermissionRoleTableSeeder.php: -------------------------------------------------------------------------------- 1 | perms()->sync($permissions); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /database/seeds/PermissionsTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 15 | //USERS 16 | [ 17 | 'name' => 'users.read', 18 | 'display_name' => 'Users / Show', 19 | 'created_at' => now(), 20 | ], 21 | [ 22 | 'name' => 'users.store', 23 | 'display_name' => 'Users / Creation', 24 | 'created_at' => now(), 25 | ], 26 | [ 27 | 'name' => 'users.update', 28 | 'display_name' => 'Users / Update', 29 | 'created_at' => now(), 30 | ], 31 | [ 32 | 'name' => 'users.destroy', 33 | 'display_name' => 'Users / Delete', 34 | 'created_at' => now(), 35 | ], 36 | 37 | [ 38 | 'name' => 'users.roles.read', 39 | 'display_name' => 'Users / Roles / Show', 40 | 'created_at' => now(), 41 | ], 42 | [ 43 | 'name' => 'users.roles.update', 44 | 'display_name' => 'Users / Roles / Update', 45 | 'created_at' => now(), 46 | ], 47 | 48 | 49 | // ROLES 50 | [ 51 | 'name' => 'roles.read', 52 | 'display_name' => 'Roles / Show', 53 | 'created_at' => now(), 54 | ], 55 | [ 56 | 'name' => 'roles.store', 57 | 'display_name' => 'Roles / Creation', 58 | 'created_at' => now(), 59 | ], 60 | [ 61 | 'name' => 'roles.update', 62 | 'display_name' => 'Roles / Update', 63 | 'created_at' => now(), 64 | ], 65 | [ 66 | 'name' => 'roles.destroy', 67 | 'display_name' => 'Roles / Delete', 68 | 'created_at' => now(), 69 | ], 70 | [ 71 | 'name' => 'roles.permissions.read', 72 | 'display_name' => 'Roles / Permissions / Show', 73 | 'created_at' => now(), 74 | ], 75 | [ 76 | 'name' => 'roles.permissions.update', 77 | 'display_name' => 'Roles / Permissions / Update', 78 | 'created_at' => now(), 79 | ], 80 | 81 | 82 | // PERMISSIONS 83 | [ 84 | 'name' => 'permissions.read', 85 | 'display_name' => 'Permissions / Show', 86 | 'created_at' => now(), 87 | ], 88 | [ 89 | 'name' => 'permissions.store', 90 | 'display_name' => 'Permissions / Creation', 91 | 'created_at' => now(), 92 | ], 93 | [ 94 | 'name' => 'permissions.update', 95 | 'display_name' => 'Permissions / Update', 96 | 'created_at' => now(), 97 | ], 98 | [ 99 | 'name' => 'permissions.destroy', 100 | 'display_name' => 'Permissions / Delete', 101 | 'created_at' => now(), 102 | ], 103 | 104 | ]); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /database/seeds/RoleUserTableSeeder.php: -------------------------------------------------------------------------------- 1 | first(); 17 | $role_admin = Role::byName('admin'); 18 | 19 | DB::table('role_user')->insert([ 20 | [ 21 | 'role_id' => $me->id, 22 | 'user_id' => $role_admin->id, 23 | ], 24 | ]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /database/seeds/RolesTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 15 | [ 16 | 'name' => 'admin', 17 | 'display_name' => 'Administrator', 18 | 'description' => 'Administrator of system.', 19 | 'created_at' => now(), 20 | ], 21 | ]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /database/seeds/UsersTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 16 | [ 17 | 'name' => 'Flávio Medeiros', 18 | 'email' => 'smedeiros.flavio@gmail.com', 19 | 'phone' => '+5519981427191', 20 | 'password' => Hash::make('secret'), 21 | 'email_verified_at' => now(), 22 | 'created_at' => now(), 23 | 'updated_at' => now(), 24 | ], 25 | ]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | 5 | api-users-app: 6 | container_name: api-users-app 7 | build: .docker/docker 8 | image: api-users-app 9 | depends_on: 10 | - api-users-mysql 11 | - api-users-redis 12 | volumes: 13 | - ./:/application:cached 14 | 15 | api-users-nginx: 16 | container_name: api-users-nginx 17 | image: nginx:alpine 18 | ports: 19 | - "8000:8000" 20 | volumes: 21 | - .docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:cached 22 | - ./:/application:cached 23 | - .docker/nginx/:/var/log/nginx/ 24 | depends_on: 25 | - api-users-app 26 | - api-users-mysql 27 | - api-users-redis 28 | 29 | api-users-mysql: 30 | container_name: api-users-mysql 31 | image: mysql:5.7 32 | ports: 33 | - "3306:3306" 34 | environment: 35 | - MYSQL_ROOT_PASSWORD=root 36 | - MYSQL_DATABASE=users 37 | volumes: 38 | - api-users-mysql-data:/var/lib/mysql:cached 39 | 40 | api-users-redis: 41 | container_name: api-users-redis 42 | image: redis:alpine 43 | ports: 44 | - "6379:6379" 45 | 46 | volumes: 47 | api-users-mysql-data: 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.18", 14 | "bootstrap": "^4.1.0", 15 | "cross-env": "^5.1", 16 | "jquery": "^3.2", 17 | "laravel-mix": "^4.0.7", 18 | "lodash": "^4.17.5", 19 | "popper.js": "^1.12", 20 | "resolve-url-loader": "^2.3.1", 21 | "sass": "^1.15.2", 22 | "sass-loader": "^7.1.0", 23 | "vue": "^2.5.17" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /phpunit.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medeiroz/laravel-microservice-auth-with-jwt/2ab7376b3523a6092428576451faf31417685092/phpunit.phar -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /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 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medeiroz/laravel-microservice-auth-with-jwt/2ab7376b3523a6092428576451faf31417685092/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * First we will load all of this project's JavaScript dependencies which 3 | * includes Vue and other libraries. It is a great starting point when 4 | * building robust, powerful web applications using Vue and Laravel. 5 | */ 6 | 7 | require('./bootstrap'); 8 | 9 | window.Vue = require('vue'); 10 | 11 | /** 12 | * The following block of code may be used to automatically register your 13 | * Vue components. It will recursively scan this directory for the Vue 14 | * components and automatically register them with their "basename". 15 | * 16 | * Eg. ./components/ExampleComponent.vue -> 17 | */ 18 | 19 | // const files = require.context('./', true, /\.vue$/i); 20 | // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)); 21 | 22 | Vue.component('example-component', require('./components/ExampleComponent.vue').default); 23 | 24 | /** 25 | * Next, we will create a fresh Vue application instance and attach it to 26 | * the page. Then, you may begin adding components to this application 27 | * or customize the JavaScript scaffolding to fit your unique needs. 28 | */ 29 | 30 | const app = new Vue({ 31 | el: '#app', 32 | }); 33 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | 3 | /** 4 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 5 | * for JavaScript based Bootstrap features such as modals and tabs. This 6 | * code may be modified to fit the specific needs of your application. 7 | */ 8 | 9 | try { 10 | window.Popper = require('popper.js').default; 11 | window.$ = window.jQuery = require('jquery'); 12 | 13 | require('bootstrap'); 14 | } catch (e) {} 15 | 16 | /** 17 | * We'll load the axios HTTP library which allows us to easily issue requests 18 | * to our Laravel back-end. This library automatically handles sending the 19 | * CSRF token as a header based on the value of the "XSRF" token cookie. 20 | */ 21 | 22 | window.axios = require('axios'); 23 | 24 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 25 | 26 | /** 27 | * Next we will register the CSRF Token as a common header with Axios so that 28 | * all outgoing HTTP requests automatically have it attached. This is just 29 | * a simple convenience so we don't have to attach every token manually. 30 | */ 31 | 32 | let token = document.head.querySelector('meta[name="csrf-token"]'); 33 | 34 | if (token) { 35 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 36 | } else { 37 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 38 | } 39 | 40 | /** 41 | * Echo exposes an expressive API for subscribing to channels and listening 42 | * for events that are broadcast by Laravel. Echo and event broadcasting 43 | * allows your team to easily build robust real-time web applications. 44 | */ 45 | 46 | // import Echo from 'laravel-echo' 47 | 48 | // window.Pusher = require('pusher-js'); 49 | 50 | // window.Echo = new Echo({ 51 | // broadcaster: 'pusher', 52 | // key: process.env.MIX_PUSHER_APP_KEY, 53 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 54 | // encrypted: true 55 | // }); 56 | -------------------------------------------------------------------------------- /resources/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least eight characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | 'The :attribute must be accepted.', 17 | 'active_url' => 'The :attribute is not a valid URL.', 18 | 'after' => 'The :attribute must be a date after :date.', 19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', 20 | 'alpha' => 'The :attribute may only contain letters.', 21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', 22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.', 23 | 'array' => 'The :attribute must be an array.', 24 | 'before' => 'The :attribute must be a date before :date.', 25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 26 | 'between' => [ 27 | 'numeric' => 'The :attribute must be between :min and :max.', 28 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 29 | 'string' => 'The :attribute must be between :min and :max characters.', 30 | 'array' => 'The :attribute must have between :min and :max items.', 31 | ], 32 | 'boolean' => 'The :attribute field must be true or false.', 33 | 'confirmed' => 'The :attribute confirmation does not match.', 34 | 'date' => 'The :attribute is not a valid date.', 35 | 'date_equals' => 'The :attribute must be a date equal to :date.', 36 | 'date_format' => 'The :attribute does not match the format :format.', 37 | 'different' => 'The :attribute and :other must be different.', 38 | 'digits' => 'The :attribute must be :digits digits.', 39 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 40 | 'dimensions' => 'The :attribute has invalid image dimensions.', 41 | 'distinct' => 'The :attribute field has a duplicate value.', 42 | 'email' => 'The :attribute must be a valid email address.', 43 | 'ends_with' => 'The :attribute must end with one of the following: :values', 44 | 'exists' => 'The selected :attribute is invalid.', 45 | 'file' => 'The :attribute must be a file.', 46 | 'filled' => 'The :attribute field must have a value.', 47 | 'gt' => [ 48 | 'numeric' => 'The :attribute must be greater than :value.', 49 | 'file' => 'The :attribute must be greater than :value kilobytes.', 50 | 'string' => 'The :attribute must be greater than :value characters.', 51 | 'array' => 'The :attribute must have more than :value items.', 52 | ], 53 | 'gte' => [ 54 | 'numeric' => 'The :attribute must be greater than or equal :value.', 55 | 'file' => 'The :attribute must be greater than or equal :value kilobytes.', 56 | 'string' => 'The :attribute must be greater than or equal :value characters.', 57 | 'array' => 'The :attribute must have :value items or more.', 58 | ], 59 | 'image' => 'The :attribute must be an image.', 60 | 'in' => 'The selected :attribute is invalid.', 61 | 'in_array' => 'The :attribute field does not exist in :other.', 62 | 'integer' => 'The :attribute must be an integer.', 63 | 'ip' => 'The :attribute must be a valid IP address.', 64 | 'ipv4' => 'The :attribute must be a valid IPv4 address.', 65 | 'ipv6' => 'The :attribute must be a valid IPv6 address.', 66 | 'json' => 'The :attribute must be a valid JSON string.', 67 | 'lt' => [ 68 | 'numeric' => 'The :attribute must be less than :value.', 69 | 'file' => 'The :attribute must be less than :value kilobytes.', 70 | 'string' => 'The :attribute must be less than :value characters.', 71 | 'array' => 'The :attribute must have less than :value items.', 72 | ], 73 | 'lte' => [ 74 | 'numeric' => 'The :attribute must be less than or equal :value.', 75 | 'file' => 'The :attribute must be less than or equal :value kilobytes.', 76 | 'string' => 'The :attribute must be less than or equal :value characters.', 77 | 'array' => 'The :attribute must not have more than :value items.', 78 | ], 79 | 'max' => [ 80 | 'numeric' => 'The :attribute may not be greater than :max.', 81 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 82 | 'string' => 'The :attribute may not be greater than :max characters.', 83 | 'array' => 'The :attribute may not have more than :max items.', 84 | ], 85 | 'mimes' => 'The :attribute must be a file of type: :values.', 86 | 'mimetypes' => 'The :attribute must be a file of type: :values.', 87 | 'min' => [ 88 | 'numeric' => 'The :attribute must be at least :min.', 89 | 'file' => 'The :attribute must be at least :min kilobytes.', 90 | 'string' => 'The :attribute must be at least :min characters.', 91 | 'array' => 'The :attribute must have at least :min items.', 92 | ], 93 | 'not_in' => 'The selected :attribute is invalid.', 94 | 'not_regex' => 'The :attribute format is invalid.', 95 | 'numeric' => 'The :attribute must be a number.', 96 | 'present' => 'The :attribute field must be present.', 97 | 'regex' => 'The :attribute format is invalid.', 98 | 'required' => 'The :attribute field is required.', 99 | 'required_if' => 'The :attribute field is required when :other is :value.', 100 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 101 | 'required_with' => 'The :attribute field is required when :values is present.', 102 | 'required_with_all' => 'The :attribute field is required when :values are present.', 103 | 'required_without' => 'The :attribute field is required when :values is not present.', 104 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 105 | 'same' => 'The :attribute and :other must match.', 106 | 'size' => [ 107 | 'numeric' => 'The :attribute must be :size.', 108 | 'file' => 'The :attribute must be :size kilobytes.', 109 | 'string' => 'The :attribute must be :size characters.', 110 | 'array' => 'The :attribute must contain :size items.', 111 | ], 112 | 'starts_with' => 'The :attribute must start with one of the following: :values', 113 | 'string' => 'The :attribute must be a string.', 114 | 'timezone' => 'The :attribute must be a valid zone.', 115 | 'unique' => 'The :attribute has already been taken.', 116 | 'uploaded' => 'The :attribute failed to upload.', 117 | 'url' => 'The :attribute format is invalid.', 118 | 'uuid' => 'The :attribute must be a valid UUID.', 119 | 120 | /* 121 | |-------------------------------------------------------------------------- 122 | | Custom Validation Language Lines 123 | |-------------------------------------------------------------------------- 124 | | 125 | | Here you may specify custom validation messages for attributes using the 126 | | convention "attribute.rule" to name the lines. This makes it quick to 127 | | specify a specific custom language line for a given attribute rule. 128 | | 129 | */ 130 | 131 | 'custom' => [ 132 | 'attribute-name' => [ 133 | 'rule-name' => 'custom-message', 134 | ], 135 | ], 136 | 137 | /* 138 | |-------------------------------------------------------------------------- 139 | | Custom Validation Attributes 140 | |-------------------------------------------------------------------------- 141 | | 142 | | The following language lines are used to swap our attribute placeholder 143 | | with something more reader friendly such as "E-Mail Address" instead 144 | | of "email". This simply helps us make our message more expressive. 145 | | 146 | */ 147 | 148 | 'attributes' => [], 149 | 150 | ]; 151 | -------------------------------------------------------------------------------- /resources/lang/pt-BR/auth.php: -------------------------------------------------------------------------------- 1 | 'Essas credenciais não foram encontradas em nossos registros.', 17 | 'throttle' => 'Muitas tentativas de login. Tente novamente em :seconds segundos.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/pt-BR/pagination.php: -------------------------------------------------------------------------------- 1 | '« Anterior', 17 | 'next' => 'Próximo »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /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 | 'token' => 'Este token de redefinição de senha é inválido.', 20 | 'user' => "Não encontramos um usuário com esse endereço de e-mail.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/pt-BR/validation.php: -------------------------------------------------------------------------------- 1 | 'O campo :attribute deve ser aceito.', 17 | 'active_url' => 'O campo :attribute não é uma URL válida.', 18 | 'after' => 'O campo :attribute deve ser uma data posterior a :date.', 19 | 'after_or_equal' => 'O campo :attribute deve ser uma data posterior ou igual a :date.', 20 | 'alpha' => 'O campo :attribute só pode conter letras.', 21 | 'alpha_dash' => 'O campo :attribute só pode conter letras, números e traços.', 22 | 'alpha_num' => 'O campo :attribute só pode conter letras e números.', 23 | 'array' => 'O campo :attribute deve ser uma matriz.', 24 | 'before' => 'O campo :attribute deve ser uma data anterior :date.', 25 | 'before_or_equal' => 'O campo :attribute deve ser uma data anterior ou igual a :date.', 26 | 'between' => [ 27 | 'numeric' => 'O campo :attribute deve ser entre :min e :max.', 28 | 'file' => 'O campo :attribute deve ser entre :min e :max kilobytes.', 29 | 'string' => 'O campo :attribute deve ser entre :min e :max caracteres.', 30 | 'array' => 'O campo :attribute deve ter entre :min e :max itens.', 31 | ], 32 | 'boolean' => 'O campo :attribute deve ser verdadeiro ou falso.', 33 | 'confirmed' => 'O campo :attribute de confirmação não confere.', 34 | 'date' => 'O campo :attribute não é uma data válida.', 35 | 'date_equals' => 'O campo :attribute deve ser uma data igual a :date.', 36 | 'date_format' => 'O campo :attribute não corresponde ao formato :format.', 37 | 'different' => 'Os campos :attribute e :other devem ser diferentes.', 38 | 'digits' => 'O campo :attribute deve ter :digits dígitos.', 39 | 'digits_between' => 'O campo :attribute deve ter entre :min e :max dígitos.', 40 | 'dimensions' => 'O campo :attribute tem dimensões de imagem inválidas.', 41 | 'distinct' => 'O campo :attribute campo tem um valor duplicado.', 42 | 'email' => 'O campo :attribute deve ser um endereço de e-mail válido.', 43 | 'exists' => 'O campo :attribute selecionado é inválido.', 44 | 'file' => 'O campo :attribute deve ser um arquivo.', 45 | 'filled' => 'O campo :attribute deve ter um valor.', 46 | 'gt' => [ 47 | 'numeric' => 'O campo :attribute deve ser maior que :value.', 48 | 'file' => 'O campo :attribute deve ser maior que :value kilobytes.', 49 | 'string' => 'O campo :attribute deve ser maior que :value caracteres.', 50 | 'array' => 'O campo :attribute deve conter mais de :value itens.', 51 | ], 52 | 'gte' => [ 53 | 'numeric' => 'O campo :attribute deve ser maior ou igual a :value.', 54 | 'file' => 'O campo :attribute deve ser maior ou igual a :value kilobytes.', 55 | 'string' => 'O campo :attribute deve ser maior ou igual a :value caracteres.', 56 | 'array' => 'O campo :attribute deve conter :value itens ou mais.', 57 | ], 58 | 'image' => 'O campo :attribute deve ser uma imagem.', 59 | 'in' => 'O campo :attribute selecionado é inválido.', 60 | 'in_array' => 'O campo :attribute não existe em :other.', 61 | 'integer' => 'O campo :attribute deve ser um número inteiro.', 62 | 'ip' => 'O campo :attribute deve ser um endereço de IP válido.', 63 | 'ipv4' => 'O campo :attribute deve ser um endereço IPv4 válido.', 64 | 'ipv6' => 'O campo :attribute deve ser um endereço IPv6 válido.', 65 | 'json' => 'O campo :attribute deve ser uma string JSON válida.', 66 | 'lt' => [ 67 | 'numeric' => 'O campo :attribute deve ser menor que :value.', 68 | 'file' => 'O campo :attribute deve ser menor que :value kilobytes.', 69 | 'string' => 'O campo :attribute deve ser menor que :value caracteres.', 70 | 'array' => 'O campo :attribute deve conter menos de :value itens.', 71 | ], 72 | 'lte' => [ 73 | 'numeric' => 'O campo :attribute deve ser menor ou igual a :value.', 74 | 'file' => 'O campo :attribute deve ser menor ou igual a :value kilobytes.', 75 | 'string' => 'O campo :attribute deve ser menor ou igual a :value caracteres.', 76 | 'array' => 'O campo :attribute não deve conter mais que :value itens.', 77 | ], 78 | 'max' => [ 79 | 'numeric' => 'O campo :attribute não pode ser superior a :max.', 80 | 'file' => 'O campo :attribute não pode ser superior a :max kilobytes.', 81 | 'string' => 'O campo :attribute não pode ser superior a :max caracteres.', 82 | 'array' => 'O campo :attribute não pode ter mais do que :max itens.', 83 | ], 84 | 'mimes' => 'O campo :attribute deve ser um arquivo do tipo: :values.', 85 | 'mimetypes' => 'O campo :attribute deve ser um arquivo do tipo: :values.', 86 | 'min' => [ 87 | 'numeric' => 'O campo :attribute deve ser pelo menos :min.', 88 | 'file' => 'O campo :attribute deve ter pelo menos :min kilobytes.', 89 | 'string' => 'O campo :attribute deve ter pelo menos :min caracteres.', 90 | 'array' => 'O campo :attribute deve ter pelo menos :min itens.', 91 | ], 92 | 'not_in' => 'O campo :attribute selecionado é inválido.', 93 | 'not_regex' => 'O campo :attribute possui um formato inválido.', 94 | 'numeric' => 'O campo :attribute deve ser um número.', 95 | 'present' => 'O campo :attribute deve estar presente.', 96 | 'regex' => 'O campo :attribute tem um formato inválido.', 97 | 'required' => 'O campo :attribute é obrigatório.', 98 | 'required_if' => 'O campo :attribute é obrigatório quando :other for :value.', 99 | 'required_unless' => 'O campo :attribute é obrigatório exceto quando :other for :values.', 100 | 'required_with' => 'O campo :attribute é obrigatório quando :values está presente.', 101 | 'required_with_all' => 'O campo :attribute é obrigatório quando :values está presente.', 102 | 'required_without' => 'O campo :attribute é obrigatório quando :values não está presente.', 103 | 'required_without_all' => 'O campo :attribute é obrigatório quando nenhum dos :values estão presentes.', 104 | 'same' => 'Os campos :attribute e :other devem corresponder.', 105 | 'size' => [ 106 | 'numeric' => 'O campo :attribute deve ser :size.', 107 | 'file' => 'O campo :attribute deve ser :size kilobytes.', 108 | 'string' => 'O campo :attribute deve ser :size caracteres.', 109 | 'array' => 'O campo :attribute deve conter :size itens.', 110 | ], 111 | 'starts_with' => 'O campo :attribute deve começar com um dos seguintes valores: :values', 112 | 'string' => 'O campo :attribute deve ser uma string.', 113 | 'timezone' => 'O campo :attribute deve ser uma zona válida.', 114 | 'unique' => 'O campo :attribute já está sendo utilizado.', 115 | 'uploaded' => 'Ocorreu uma falha no upload do campo :attribute.', 116 | 'url' => 'O campo :attribute tem um formato inválido.', 117 | 'uuid' => 'O campo :attribute deve ser um UUID válido.', 118 | 119 | /* 120 | |-------------------------------------------------------------------------- 121 | | Custom Validation Language Lines 122 | |-------------------------------------------------------------------------- 123 | | 124 | | Here you may specify custom validation messages for attributes using the 125 | | convention "attribute.rule" to name the lines. This makes it quick to 126 | | specify a specific custom language line for a given attribute rule. 127 | | 128 | */ 129 | 130 | 'custom' => [ 131 | 'attribute-name' => [ 132 | 'rule-name' => 'custom-message', 133 | ], 134 | ], 135 | 136 | /* 137 | |-------------------------------------------------------------------------- 138 | | Custom Validation Attributes 139 | |-------------------------------------------------------------------------- 140 | | 141 | | The following language lines are used to swap our attribute placeholder 142 | | with something more reader friendly such as "E-Mail Address" instead 143 | | of "email". This simply helps us make our message more expressive. 144 | | 145 | */ 146 | 147 | 'attributes' => [], 148 | 149 | ]; 150 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | // Body 2 | $body-bg: #f8fafc; 3 | 4 | // Typography 5 | $font-family-sans-serif: 'Nunito', sans-serif; 6 | $font-size-base: 0.9rem; 7 | $line-height-base: 1.6; 8 | 9 | // Colors 10 | $blue: #3490dc; 11 | $indigo: #6574cd; 12 | $purple: #9561e2; 13 | $pink: #f66d9b; 14 | $red: #e3342f; 15 | $orange: #f6993f; 16 | $yellow: #ffed4a; 17 | $green: #38c172; 18 | $teal: #4dc0b5; 19 | $cyan: #6cb2eb; 20 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Fonts 2 | @import url('https://fonts.googleapis.com/css?family=Nunito'); 3 | 4 | // Variables 5 | @import 'variables'; 6 | 7 | // Bootstrap 8 | @import '~bootstrap/scss/bootstrap'; 9 | -------------------------------------------------------------------------------- /resources/views/emails/account_recovery.blade.php: -------------------------------------------------------------------------------- 1 | essa é a url {{ $url }} 2 | -------------------------------------------------------------------------------- /resources/views/emails/account_verification.blade.php: -------------------------------------------------------------------------------- 1 | essa é a url {{ $url }} 2 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Laravel 8 | 9 | 10 | 11 | 12 | 13 | 65 | 66 | 67 |
68 | @if (Route::has('login')) 69 | 80 | @endif 81 | 82 |
83 |
84 | Laravel 85 |
86 | 87 | 96 |
97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | name('auth.')->prefix('auth')->group(function() { 7 | 8 | /** Login **/ 9 | Route::post('login', 'LoginController@login')->name('login'); 10 | 11 | Route::middleware(['jwt.auth', 'verified'])->group(function() { 12 | Route::post('logout', 'LoginController@logout')->name('logout'); 13 | Route::any('me', 'LoginController@me')->name('me'); 14 | }); 15 | 16 | Route::put('refresh', 'LoginController@refresh')->middleware('jwt.refresh')->name('refresh'); 17 | 18 | }); 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /routes/api/permissions.php: -------------------------------------------------------------------------------- 1 | group(function(){ 7 | 8 | /** Permissions **/ 9 | Route::middleware('permission:permissions.read')->group(function() { 10 | Route::get('permissions', 'PermissionsController@index') 11 | ->name('permissions.index'); 12 | 13 | Route::post('permissions', 'PermissionsController@store') 14 | ->name('permissions.store') 15 | ->middleware('permission:permissions.store'); 16 | 17 | Route::get('permissions/{permission}', 'PermissionsController@show') 18 | ->name('permissions.show'); 19 | 20 | Route::match(['put', 'patch'], 'permissions/{permission}', 'PermissionsController@update') 21 | ->name('permissions.update') 22 | ->middleware('permission:permissions.update'); 23 | 24 | Route::delete('permissions/{permission}', 'PermissionsController@destroy') 25 | ->name('permissions.destroy') 26 | ->middleware('permission:permissions.destroy'); 27 | }); 28 | 29 | }); 30 | -------------------------------------------------------------------------------- /routes/api/register.php: -------------------------------------------------------------------------------- 1 | name('register.')->prefix('register')->group(function() { 7 | 8 | /** Register **/ 9 | Route::post('create', 'RegisterController@create') 10 | ->name('create'); 11 | 12 | Route::post('send_email_verification/{email}', 'RegisterController@sendEmailVerification') 13 | ->name('send_email_verification'); 14 | 15 | Route::get('verification', 'RegisterController@verification') 16 | ->name('verification'); 17 | 18 | Route::post('recovery/{email}', 'RegisterController@recovery') 19 | ->name('recovery'); 20 | 21 | Route::put('update_password', 'RegisterController@updatePassword') 22 | ->name('update_password'); 23 | }); 24 | 25 | -------------------------------------------------------------------------------- /routes/api/roles.php: -------------------------------------------------------------------------------- 1 | group(function(){ 7 | 8 | /** Roles **/ 9 | Route::middleware('permission:roles.read')->group(function() { 10 | Route::get('roles', 'RolesController@index') 11 | ->name('roles.index'); 12 | 13 | Route::post('roles', 'RolesController@store') 14 | ->name('roles.store') 15 | ->middleware('permission:roles.store'); 16 | 17 | Route::get('roles/{role}', 'RolesController@show') 18 | ->name('roles.show'); 19 | 20 | Route::match(['put', 'patch'], 'roles/{role}', 'RolesController@update') 21 | ->name('roles.update') 22 | ->middleware('permission:roles.update'); 23 | 24 | Route::delete('roles/{role}', 'RolesController@destroy') 25 | ->name('roles.destroy') 26 | ->middleware('permission:roles.destroy'); 27 | }); 28 | 29 | 30 | /** Roles -> Permissions **/ 31 | Route::middleware('permission:users.roles.read')->group(function() { 32 | 33 | Route::get('roles/{role}/permissions', 'RolesPermissionsController@index') 34 | ->name('roles.permissions.index') 35 | ->middleware('permission:permissions.store'); 36 | 37 | Route::put('roles/{role}/permissions', 'RolesPermissionsController@sync') 38 | ->name('roles.permissions.sync') 39 | ->middleware('permission:permissions.store'); 40 | }); 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /routes/api/users.php: -------------------------------------------------------------------------------- 1 | group(function() { 7 | 8 | /** Users **/ 9 | Route::middleware('permission:users.read')->group(function() { 10 | Route::get('users', 'UsersController@index') 11 | ->name('users.index'); 12 | 13 | Route::post('users', 'UsersController@store') 14 | ->name('users.store') 15 | ->middleware('permission:users.store'); 16 | 17 | Route::get('users/{user}', 'UsersController@show') 18 | ->name('users.show'); 19 | 20 | Route::match(['put', 'patch'], 'users/{user}', 'UsersController@update') 21 | ->name('users.update') 22 | ->middleware('permission:users.update'); 23 | 24 | Route::delete('users/{user}', 'UsersController@destroy') 25 | ->name('users.destroy') 26 | ->middleware('permission:users.destroy'); 27 | }); 28 | 29 | 30 | /** Users -> Roles **/ 31 | Route::middleware('permission:users.roles.read')->group(function() { 32 | 33 | Route::get('users/{user}/roles', 'UsersRolesController@index') 34 | ->name('users.roles.index'); 35 | 36 | Route::put('users/{user}/roles', 'UsersRolesController@sync') 37 | ->name('users.roles.sync') 38 | ->middleware('permission:users.roles.update'); 39 | }); 40 | 41 | }); 42 | 43 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /routes/web.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 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/Unit/UserTest.php: -------------------------------------------------------------------------------- 1 | fill([ 23 | 'id' => 1, 24 | 'name' => 'Flávio Medeiros', 25 | 'email' => 'smedeiros.flavio@gmail.com', 26 | 'password' => Hash::make('secret'), 27 | 'created_at' => now(), 28 | 'updated_at' => now(), 29 | ]); 30 | 31 | 32 | $this->assertEquals($user->first_name, "Flávio"); 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/js/app.js', 'public/js') 15 | .sass('resources/sass/app.scss', 'public/css'); 16 | --------------------------------------------------------------------------------