├── .babelrc ├── .editorconfig ├── .env.example ├── .eslintrc.js ├── .gitattributes ├── .gitignore ├── .nvmrc ├── .prettierignore ├── .prettierrc ├── .travis.yml ├── LICENSE ├── README.md ├── app ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── AuthController.php │ │ ├── Controller.php │ │ ├── PasswordResetController.php │ │ ├── UserConfirmationController.php │ │ └── UserController.php │ ├── Kernel.php │ └── Middleware │ │ ├── CheckForMaintenanceMode.php │ │ ├── EncryptCookies.php │ │ ├── FilterConfirmedUsers.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php ├── Mail │ ├── EmailConfirmation.php │ └── PasswordResetRequest.php ├── Models │ └── User.php └── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── database.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 └── seeds │ └── DatabaseSeeder.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── 0.js ├── 1.js ├── 2.js ├── 3.js ├── 4.js ├── 5.js ├── 6.js ├── 7.js ├── css │ └── app.css ├── favicon.ico ├── index.php ├── js │ └── app.js ├── mix-manifest.json └── robots.txt ├── resources ├── assets │ ├── js │ │ ├── __tests__ │ │ │ └── store │ │ │ │ ├── client.test.js │ │ │ │ └── modules │ │ │ │ └── user.test.js │ │ ├── app.js │ │ ├── components │ │ │ └── App.vue │ │ ├── pages │ │ │ ├── ConfirmEmail.vue │ │ │ ├── Dashboard.vue │ │ │ ├── EmailConfirmed.vue │ │ │ ├── Index.vue │ │ │ ├── Login.vue │ │ │ ├── NewPassword.vue │ │ │ ├── Register.vue │ │ │ └── ResetPassword.vue │ │ ├── router │ │ │ └── index.js │ │ └── store │ │ │ ├── client │ │ │ ├── __mocks__ │ │ │ │ └── index.js │ │ │ └── index.js │ │ │ ├── index.js │ │ │ ├── modules │ │ │ └── user.js │ │ │ └── mutation-types.js │ └── styles │ │ ├── _animations.scss │ │ ├── _components.scss │ │ ├── _custom-utilities.scss │ │ └── app.scss ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ ├── emails │ ├── confirm-email.blade.php │ └── password-reset-request.blade.php │ └── index.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php ├── Unit │ └── UserTest.php └── Utilities │ └── functions.php ├── webpack.mix.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "modules": false 7 | } 8 | ] 9 | ], 10 | "env": { 11 | "test": { 12 | "plugins": ["transform-object-rest-spread"], 13 | "presets": [ 14 | [ 15 | "env", 16 | { 17 | "targets": { 18 | "node": "current" 19 | } 20 | } 21 | ] 22 | ] 23 | } 24 | }, 25 | "plugins": ["transform-async-to-generator", "transform-runtime", "syntax-dynamic-import"] 26 | } 27 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | [*.php] 11 | indent_size = 4 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=homestead 13 | DB_USERNAME=homestead 14 | DB_PASSWORD=secret 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | SESSION_DRIVER=file 19 | SESSION_LIFETIME=120 20 | QUEUE_DRIVER=sync 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_DRIVER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | 33 | PUSHER_APP_ID= 34 | PUSHER_APP_KEY= 35 | PUSHER_APP_SECRET= 36 | PUSHER_APP_CLUSTER=mt1 37 | 38 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 39 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 40 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'vue-eslint-parser', 4 | parserOptions: { 5 | parser: 'babel-eslint', 6 | sourceType: 'module', 7 | ecmaVersion: 8, 8 | allowImportExportEverywhere: true 9 | }, 10 | extends: ['standard', 'plugin:vue/recommended'], 11 | plugins: ['vue'], 12 | rules: { 13 | 'vue/require-default-prop': 'off', 14 | 'vue/require-prop-types': 'off', 15 | 'vue/html-self-closing': 'off' 16 | }, 17 | overrides: [ 18 | { 19 | files: ['**/*.test.js'], 20 | env: { 21 | jest: true 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /.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 | /.idea 7 | /.vagrant 8 | Homestead.json 9 | Homestead.yaml 10 | npm-debug.log 11 | yarn-error.log 12 | .env 13 | **/.DS_Store 14 | /.vscode 15 | **/*.orig 16 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 8.9.4 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "overrides": [ 3 | { 4 | "files": ".babelrc", 5 | "options": { 6 | "parser": "json" 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.1 5 | - 7.2 6 | 7 | sudo: false 8 | 9 | cache: 10 | directories: 11 | - $HOME/.composer/cache 12 | 13 | services: 14 | - redis-server 15 | 16 | before_install: 17 | - travis_retry composer self-update 18 | 19 | install: 20 | - travis_retry composer install --no-interaction --prefer-dist --no-suggest 21 | 22 | script: vendor/bin/phpunit 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Collin Henderson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel SPA Boilerplate 2 | 3 | My personal and opinionated boilerplate for building SPAs with Laravel, Vue, and Tailwind. 4 | 5 | ### Features 6 | 7 | - Backend for creating, and authenticating users with JWT, and confirming their email. 8 | - Backend support for password resets. 9 | - Client-side code-splitted routes and views for login, registration, email confirmation, and password resets. 10 | - Vuex store with user module. 11 | - Tailwind for styling. 12 | 13 | ### TODO: 14 | 15 | - [ ] More tests 16 | - [ ] Documentation for key features 17 | -------------------------------------------------------------------------------- /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 | middleware('auth:api', ['except' => ['login']]); 13 | } 14 | 15 | public function login() 16 | { 17 | $credentials = request(['email', 'password']); 18 | 19 | if (!$token = auth()->attempt($credentials)) { 20 | return response()->json(['error' => 'Unauthorized'], 401); 21 | } 22 | 23 | return $this->respondWithToken($token); 24 | } 25 | 26 | public function me(Request $request) 27 | { 28 | return auth()->user(); 29 | } 30 | 31 | public function refresh() 32 | { 33 | return $this->respondWithToken(auth()->refresh()); 34 | } 35 | 36 | 37 | public function logout() 38 | { 39 | auth()->logout(); 40 | 41 | return response()->json([], 205); 42 | } 43 | 44 | protected function respondWithToken($token) 45 | { 46 | return response()->json([ 47 | 'token' => $token, 48 | 'expiry' => auth()->factory()->getTTL() * 60, 49 | 'user' => auth()->user(), 50 | ]); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | exists()) { 19 | return response()->json(['error' => 'There is no account in our system associated with the email address "' . $email . '".'], 403); 20 | } 21 | 22 | $token = str_limit(md5($email . str_random()), 32, ''); 23 | 24 | DB::table('password_resets')->insert( 25 | [ 26 | 'email' => $email, 27 | 'created_at' => now(), 28 | 'expires_at' => now()->addHour(), 29 | 'token' => $token, 30 | ] 31 | ); 32 | 33 | Mail::to($email)->send(new PasswordResetRequest($token)); 34 | } 35 | 36 | public function update() 37 | { 38 | $validatedData = request()->validate([ 39 | 'token' => 'bail|required', 40 | 'password' => 'bail|required|confirmed', 41 | ]); 42 | 43 | $resetEntry = DB::table('password_resets')->where('token', request('token'))->first(); 44 | 45 | if (!$resetEntry) { 46 | return response()->json(['error' => 'No reset request found for this email'], 403); 47 | } 48 | 49 | if (now() > Carbon::parse($resetEntry->expires_at)) { 50 | return response()->json(['error' => 'Your password reset session has expired.'], 403); 51 | } 52 | 53 | $user = User::where('email', $resetEntry->email)->first(); 54 | 55 | $user->password = request('password'); 56 | $user->save(); 57 | 58 | DB::table('password_resets')->where('token', request('token'))->delete(); 59 | 60 | return response()->json([], 200); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/Http/Controllers/UserConfirmationController.php: -------------------------------------------------------------------------------- 1 | first(); 13 | if (!$user) { 14 | return 'Invalid confirmation token.'; 15 | } 16 | 17 | $user->confirm(); 18 | 19 | return redirect('/email-confirmed'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Controllers/UserController.php: -------------------------------------------------------------------------------- 1 | middleware('auth:api', ['except' => ['store']]); 15 | } 16 | 17 | public function store() 18 | { 19 | $validatedData = request()->validate([ 20 | 'name' => 'required', 21 | 'email' => 'required|email|unique:users', 22 | 'password' => 'required|confirmed', 23 | ]); 24 | 25 | $user = User::create(request(['name', 'email', 'password'])); 26 | 27 | $token = auth()->login($user); 28 | 29 | Mail::to($user)->send(new EmailConfirmation($user)); 30 | 31 | return response()->json([ 32 | 'token' => $token, 33 | 'expiry' => auth()->factory()->getTTL() * 60, 34 | 'user' => auth()->user(), 35 | ]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /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' => \Illuminate\Auth\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 | 'confirmed' => \App\Http\Middleware\FilterConfirmedUsers::class, 63 | ]; 64 | } 65 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | user()->confirmed) { 21 | return redirect('/confirm-email'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | user = $user; 19 | } 20 | 21 | public function build() 22 | { 23 | return $this->markdown('emails.confirm-email'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Mail/PasswordResetRequest.php: -------------------------------------------------------------------------------- 1 | token = $token; 19 | } 20 | 21 | public function build() 22 | { 23 | return $this->markdown('emails.password-reset-request'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 'boolean' 21 | ]; 22 | 23 | public function setPasswordAttribute($value) 24 | { 25 | $this->attributes['password'] = bcrypt($value); 26 | } 27 | 28 | public function getJWTIdentifier() 29 | { 30 | return $this->getKey(); 31 | } 32 | 33 | public function getJWTCustomClaims() 34 | { 35 | return []; 36 | } 37 | 38 | public function confirm() 39 | { 40 | $this->confirmed = true; 41 | $this->confirmation_token = null; 42 | $this->save(); 43 | } 44 | 45 | protected static function boot() 46 | { 47 | parent::boot(); 48 | 49 | static::creating(function ($user) { 50 | $user->confirmation_token = str_limit(md5($user->email . str_random()), 32, ''); 51 | }); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any events for your application. 23 | * 24 | * @return void 25 | */ 26 | public function boot() 27 | { 28 | parent::boot(); 29 | 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /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": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": [ 5 | "framework", 6 | "laravel" 7 | ], 8 | "license": "MIT", 9 | "type": "project", 10 | "require": { 11 | "php": "^7.1.3", 12 | "fideloper/proxy": "^4.0", 13 | "laravel/framework": "5.6.*", 14 | "laravel/tinker": "^1.0", 15 | "tymon/jwt-auth": "^1.0.0-rc.1" 16 | }, 17 | "require-dev": { 18 | "codedungeon/phpunit-result-printer": "^0.19.12", 19 | "filp/whoops": "^2.0", 20 | "fzaninotto/faker": "^1.4", 21 | "mockery/mockery": "^1.0", 22 | "nunomaduro/collision": "^2.0", 23 | "phpunit/phpunit": "^7.0" 24 | }, 25 | "autoload": { 26 | "classmap": [ 27 | "database/seeds", 28 | "database/factories" 29 | ], 30 | "psr-4": { 31 | "App\\": "app/" 32 | } 33 | }, 34 | "autoload-dev": { 35 | "psr-4": { 36 | "Tests\\": "tests/" 37 | }, 38 | "files": [ 39 | "tests/Utilities/functions.php" 40 | ] 41 | }, 42 | "extra": { 43 | "laravel": { 44 | "dont-discover": [] 45 | } 46 | }, 47 | "scripts": { 48 | "post-root-package-install": [ 49 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 50 | ], 51 | "post-create-project-cmd": [ 52 | "@php artisan key:generate" 53 | ], 54 | "post-autoload-dump": [ 55 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 56 | "@php artisan package:discover" 57 | ] 58 | }, 59 | "config": { 60 | "preferred-install": "dist", 61 | "sort-packages": true, 62 | "optimize-autoloader": true 63 | }, 64 | "minimum-stability": "dev", 65 | "prefer-stable": true 66 | } 67 | -------------------------------------------------------------------------------- /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 your 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 | /* 58 | |-------------------------------------------------------------------------- 59 | | Application Timezone 60 | |-------------------------------------------------------------------------- 61 | | 62 | | Here you may specify the default timezone for your application, which 63 | | will be used by the PHP date and date-time functions. We have gone 64 | | ahead and set this to a sensible default for you out of the box. 65 | | 66 | */ 67 | 68 | 'timezone' => 'UTC', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Application Locale Configuration 73 | |-------------------------------------------------------------------------- 74 | | 75 | | The application locale determines the default locale that will be used 76 | | by the translation service provider. You are free to set this value 77 | | to any of the locales which will be supported by the application. 78 | | 79 | */ 80 | 81 | 'locale' => 'en', 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Application Fallback Locale 86 | |-------------------------------------------------------------------------- 87 | | 88 | | The fallback locale determines the locale to use when the current one 89 | | is not available. You may change the value to correspond to any of 90 | | the language folders that are provided through your application. 91 | | 92 | */ 93 | 94 | 'fallback_locale' => 'en', 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Encryption Key 99 | |-------------------------------------------------------------------------- 100 | | 101 | | This key is used by the Illuminate encrypter service and should be set 102 | | to a random, 32 character string, otherwise these encrypted strings 103 | | will not be safe. Please do this before deploying an application! 104 | | 105 | */ 106 | 107 | 'key' => env('APP_KEY'), 108 | 109 | 'cipher' => 'AES-256-CBC', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Autoloaded Service Providers 114 | |-------------------------------------------------------------------------- 115 | | 116 | | The service providers listed here will be automatically loaded on the 117 | | request to your application. Feel free to add your own services to 118 | | this array to grant expanded functionality to your applications. 119 | | 120 | */ 121 | 122 | 'providers' => [ 123 | 124 | /* 125 | * Laravel Framework Service Providers... 126 | */ 127 | Illuminate\Auth\AuthServiceProvider::class, 128 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 129 | Illuminate\Bus\BusServiceProvider::class, 130 | Illuminate\Cache\CacheServiceProvider::class, 131 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 132 | Illuminate\Cookie\CookieServiceProvider::class, 133 | Illuminate\Database\DatabaseServiceProvider::class, 134 | Illuminate\Encryption\EncryptionServiceProvider::class, 135 | Illuminate\Filesystem\FilesystemServiceProvider::class, 136 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 137 | Illuminate\Hashing\HashServiceProvider::class, 138 | Illuminate\Mail\MailServiceProvider::class, 139 | Illuminate\Notifications\NotificationServiceProvider::class, 140 | Illuminate\Pagination\PaginationServiceProvider::class, 141 | Illuminate\Pipeline\PipelineServiceProvider::class, 142 | Illuminate\Queue\QueueServiceProvider::class, 143 | Illuminate\Redis\RedisServiceProvider::class, 144 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 145 | Illuminate\Session\SessionServiceProvider::class, 146 | Illuminate\Translation\TranslationServiceProvider::class, 147 | Illuminate\Validation\ValidationServiceProvider::class, 148 | Illuminate\View\ViewServiceProvider::class, 149 | 150 | /* 151 | * Package Service Providers... 152 | */ 153 | 154 | /* 155 | * Application Service Providers... 156 | */ 157 | App\Providers\AppServiceProvider::class, 158 | App\Providers\AuthServiceProvider::class, 159 | // App\Providers\BroadcastServiceProvider::class, 160 | App\Providers\EventServiceProvider::class, 161 | App\Providers\RouteServiceProvider::class, 162 | 163 | ], 164 | 165 | /* 166 | |-------------------------------------------------------------------------- 167 | | Class Aliases 168 | |-------------------------------------------------------------------------- 169 | | 170 | | This array of class aliases will be registered when this application 171 | | is started. However, feel free to register as many as you wish as 172 | | the aliases are "lazy" loaded so they don't hinder performance. 173 | | 174 | */ 175 | 176 | 'aliases' => [ 177 | 178 | 'App' => Illuminate\Support\Facades\App::class, 179 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 180 | 'Auth' => Illuminate\Support\Facades\Auth::class, 181 | 'Blade' => Illuminate\Support\Facades\Blade::class, 182 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 183 | 'Bus' => Illuminate\Support\Facades\Bus::class, 184 | 'Cache' => Illuminate\Support\Facades\Cache::class, 185 | 'Config' => Illuminate\Support\Facades\Config::class, 186 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 187 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 188 | 'DB' => Illuminate\Support\Facades\DB::class, 189 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 190 | 'Event' => Illuminate\Support\Facades\Event::class, 191 | 'File' => Illuminate\Support\Facades\File::class, 192 | 'Gate' => Illuminate\Support\Facades\Gate::class, 193 | 'Hash' => Illuminate\Support\Facades\Hash::class, 194 | 'Lang' => Illuminate\Support\Facades\Lang::class, 195 | 'Log' => Illuminate\Support\Facades\Log::class, 196 | 'Mail' => Illuminate\Support\Facades\Mail::class, 197 | 'Notification' => Illuminate\Support\Facades\Notification::class, 198 | 'Password' => Illuminate\Support\Facades\Password::class, 199 | 'Queue' => Illuminate\Support\Facades\Queue::class, 200 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 201 | 'Redis' => Illuminate\Support\Facades\Redis::class, 202 | 'Request' => Illuminate\Support\Facades\Request::class, 203 | 'Response' => Illuminate\Support\Facades\Response::class, 204 | 'Route' => Illuminate\Support\Facades\Route::class, 205 | 'Schema' => Illuminate\Support\Facades\Schema::class, 206 | 'Session' => Illuminate\Support\Facades\Session::class, 207 | 'Storage' => Illuminate\Support\Facades\Storage::class, 208 | 'URL' => Illuminate\Support\Facades\URL::class, 209 | 'Validator' => Illuminate\Support\Facades\Validator::class, 210 | 'View' => Illuminate\Support\Facades\View::class, 211 | 212 | ], 213 | 214 | ]; 215 | -------------------------------------------------------------------------------- /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\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | You may specify multiple password reset configurations if you have more 85 | | than one user table or model in the application and you want to have 86 | | separate password reset settings based on the specific user types. 87 | | 88 | | The expire time is the number of minutes that the reset token should be 89 | | considered valid. This security feature keeps tokens short-lived so 90 | | they have less time to be guessed. You may change this as needed. 91 | | 92 | */ 93 | 94 | 'passwords' => [ 95 | 'users' => [ 96 | 'provider' => 'users', 97 | 'table' => 'password_resets', 98 | 'expire' => 60, 99 | ], 100 | ], 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /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'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache/data'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 55 | 'sasl' => [ 56 | env('MEMCACHED_USERNAME'), 57 | env('MEMCACHED_PASSWORD'), 58 | ], 59 | 'options' => [ 60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 61 | ], 62 | 'servers' => [ 63 | [ 64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 65 | 'port' => env('MEMCACHED_PORT', 11211), 66 | 'weight' => 100, 67 | ], 68 | ], 69 | ], 70 | 71 | 'redis' => [ 72 | 'driver' => 'redis', 73 | 'connection' => 'default', 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Cache Key Prefix 81 | |-------------------------------------------------------------------------- 82 | | 83 | | When utilizing a RAM based store such as APC or Memcached, there might 84 | | be other applications utilizing the same cache. So, we'll specify a 85 | | value to get prefixed to all our keys so we can avoid collisions. 86 | | 87 | */ 88 | 89 | 'prefix' => env( 90 | 'CACHE_PREFIX', 91 | str_slug(env('APP_NAME', 'laravel'), '_').'_cache' 92 | ), 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Database Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here are each of the database connections setup for your application. 24 | | Of course, examples of configuring each database platform that is 25 | | supported by Laravel is shown below to make development simple. 26 | | 27 | | 28 | | All database work in Laravel is done through the PHP PDO facilities 29 | | so make sure you have the driver for your particular database of 30 | | choice installed on your machine before you begin development. 31 | | 32 | */ 33 | 34 | 'connections' => [ 35 | 36 | 'sqlite' => [ 37 | 'driver' => 'sqlite', 38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 39 | 'prefix' => '', 40 | ], 41 | 42 | 'mysql' => [ 43 | 'driver' => 'mysql', 44 | 'host' => env('DB_HOST', '127.0.0.1'), 45 | 'port' => env('DB_PORT', '3306'), 46 | 'database' => env('DB_DATABASE', 'forge'), 47 | 'username' => env('DB_USERNAME', 'forge'), 48 | 'password' => env('DB_PASSWORD', ''), 49 | 'unix_socket' => env('DB_SOCKET', ''), 50 | 'charset' => 'utf8mb4', 51 | 'collation' => 'utf8mb4_unicode_ci', 52 | 'prefix' => '', 53 | 'strict' => true, 54 | 'engine' => null, 55 | ], 56 | 57 | 'pgsql' => [ 58 | 'driver' => 'pgsql', 59 | 'host' => env('DB_HOST', '127.0.0.1'), 60 | 'port' => env('DB_PORT', '5432'), 61 | 'database' => env('DB_DATABASE', 'forge'), 62 | 'username' => env('DB_USERNAME', 'forge'), 63 | 'password' => env('DB_PASSWORD', ''), 64 | 'charset' => 'utf8', 65 | 'prefix' => '', 66 | 'schema' => 'public', 67 | 'sslmode' => 'prefer', 68 | ], 69 | 70 | 'sqlsrv' => [ 71 | 'driver' => 'sqlsrv', 72 | 'host' => env('DB_HOST', 'localhost'), 73 | 'port' => env('DB_PORT', '1433'), 74 | 'database' => env('DB_DATABASE', 'forge'), 75 | 'username' => env('DB_USERNAME', 'forge'), 76 | 'password' => env('DB_PASSWORD', ''), 77 | 'charset' => 'utf8', 78 | 'prefix' => '', 79 | ], 80 | 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Migration Repository Table 86 | |-------------------------------------------------------------------------- 87 | | 88 | | This table keeps track of all the migrations that have already run for 89 | | your application. Using this information, we can determine which of 90 | | the migrations on disk haven't actually been run in the database. 91 | | 92 | */ 93 | 94 | 'migrations' => 'migrations', 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Redis Databases 99 | |-------------------------------------------------------------------------- 100 | | 101 | | Redis is an open source, fast, and advanced key-value store that also 102 | | provides a richer set of commands than a typical key-value systems 103 | | such as APC or Memcached. Laravel makes it easy to dig right in. 104 | | 105 | */ 106 | 107 | 'redis' => [ 108 | 109 | 'client' => 'predis', 110 | 111 | 'default' => [ 112 | 'host' => env('REDIS_HOST', '127.0.0.1'), 113 | 'password' => env('REDIS_PASSWORD', null), 114 | 'port' => env('REDIS_PORT', 6379), 115 | 'database' => 0, 116 | ], 117 | 118 | ], 119 | 120 | ]; 121 | -------------------------------------------------------------------------------- /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 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /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 | | 101 | */ 102 | 103 | 'ttl' => env('JWT_TTL', 60), 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Refresh time to live 108 | |-------------------------------------------------------------------------- 109 | | 110 | | Specify the length of time (in minutes) that the token can be refreshed 111 | | within. I.E. The user can refresh their token within a 2 week window of 112 | | the original token being created until they must re-authenticate. 113 | | Defaults to 2 weeks. 114 | | 115 | | You can also set this to null, to yield an infinite refresh time. 116 | | Some may want this instead of never expiring tokens for e.g. a mobile app. 117 | | This is not particularly recommended, so make sure you have appropriate 118 | | systems in place to revoke the token if necessary. 119 | | 120 | */ 121 | 122 | 'refresh_ttl' => env('JWT_REFRESH_TTL', 20160), 123 | 124 | /* 125 | |-------------------------------------------------------------------------- 126 | | JWT hashing algorithm 127 | |-------------------------------------------------------------------------- 128 | | 129 | | Specify the hashing algorithm that will be used to sign the token. 130 | | 131 | | See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL 132 | | for possible values. 133 | | 134 | */ 135 | 136 | 'algo' => env('JWT_ALGO', 'HS256'), 137 | 138 | /* 139 | |-------------------------------------------------------------------------- 140 | | Required Claims 141 | |-------------------------------------------------------------------------- 142 | | 143 | | Specify the required claims that must exist in any token. 144 | | A TokenInvalidException will be thrown if any of these claims are not 145 | | present in the payload. 146 | | 147 | */ 148 | 149 | 'required_claims' => [ 150 | 'iss', 151 | 'iat', 152 | 'exp', 153 | 'nbf', 154 | 'sub', 155 | 'jti', 156 | ], 157 | 158 | /* 159 | |-------------------------------------------------------------------------- 160 | | Persistent Claims 161 | |-------------------------------------------------------------------------- 162 | | 163 | | Specify the claim keys to be persisted when refreshing a token. 164 | | `sub` and `iat` will automatically be persisted, in 165 | | addition to the these claims. 166 | | 167 | | Note: If a claim does not exist then it will be ignored. 168 | | 169 | */ 170 | 171 | 'persistent_claims' => [ 172 | // 'foo', 173 | // 'bar', 174 | ], 175 | 176 | /* 177 | |-------------------------------------------------------------------------- 178 | | Lock Subject 179 | |-------------------------------------------------------------------------- 180 | | 181 | | This will determine whether a `prv` claim is automatically added to 182 | | the token. The purpose of this is to ensure that if you have multiple 183 | | authentication models e.g. `App\User` & `App\OtherPerson`, then we 184 | | should prevent one authentication request from impersonating another, 185 | | if 2 tokens happen to have the same id across the 2 different models. 186 | | 187 | | Under specific circumstances, you may want to disable this behaviour 188 | | e.g. if you only have one authentication model, then you would save 189 | | a little on token size. 190 | | 191 | */ 192 | 193 | 'lock_subject' => true, 194 | 195 | /* 196 | |-------------------------------------------------------------------------- 197 | | Leeway 198 | |-------------------------------------------------------------------------- 199 | | 200 | | This property gives the jwt timestamp claims some "leeway". 201 | | Meaning that if you have any unavoidable slight clock skew on 202 | | any of your servers then this will afford you some level of cushioning. 203 | | 204 | | This applies to the claims `iat`, `nbf` and `exp`. 205 | | 206 | | Specify in seconds - only if you know you need it. 207 | | 208 | */ 209 | 210 | 'leeway' => env('JWT_LEEWAY', 0), 211 | 212 | /* 213 | |-------------------------------------------------------------------------- 214 | | Blacklist Enabled 215 | |-------------------------------------------------------------------------- 216 | | 217 | | In order to invalidate tokens, you must have the blacklist enabled. 218 | | If you do not want or need this functionality, then set this to false. 219 | | 220 | */ 221 | 222 | 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true), 223 | 224 | /* 225 | | ------------------------------------------------------------------------- 226 | | Blacklist Grace Period 227 | | ------------------------------------------------------------------------- 228 | | 229 | | When multiple concurrent requests are made with the same JWT, 230 | | it is possible that some of them fail, due to token regeneration 231 | | on every request. 232 | | 233 | | Set grace period in seconds to prevent parallel request failure. 234 | | 235 | */ 236 | 237 | 'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0), 238 | 239 | /* 240 | |-------------------------------------------------------------------------- 241 | | Cookies encryption 242 | |-------------------------------------------------------------------------- 243 | | 244 | | By default Laravel encrypt cookies for security reason. 245 | | If you decide to not decrypt cookies, you will have to configure Laravel 246 | | to not encrypt your cookie token by adding its name into the $except 247 | | array available in the middleware "EncryptCookies" provided by Laravel. 248 | | see https://laravel.com/docs/master/responses#cookies-and-encryption 249 | | for details. 250 | | 251 | | Set it to true if you want to decrypt cookies. 252 | | 253 | */ 254 | 255 | 'decrypt_cookies' => false, 256 | 257 | /* 258 | |-------------------------------------------------------------------------- 259 | | Providers 260 | |-------------------------------------------------------------------------- 261 | | 262 | | Specify the various providers used throughout the package. 263 | | 264 | */ 265 | 266 | 'providers' => [ 267 | 268 | /* 269 | |-------------------------------------------------------------------------- 270 | | JWT Provider 271 | |-------------------------------------------------------------------------- 272 | | 273 | | Specify the provider that is used to create and decode the tokens. 274 | | 275 | */ 276 | 277 | 'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class, 278 | 279 | /* 280 | |-------------------------------------------------------------------------- 281 | | Authentication Provider 282 | |-------------------------------------------------------------------------- 283 | | 284 | | Specify the provider that is used to authenticate users. 285 | | 286 | */ 287 | 288 | 'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class, 289 | 290 | /* 291 | |-------------------------------------------------------------------------- 292 | | Storage Provider 293 | |-------------------------------------------------------------------------- 294 | | 295 | | Specify the provider that is used to store tokens in the blacklist. 296 | | 297 | */ 298 | 299 | 'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class, 300 | 301 | ], 302 | 303 | ]; 304 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Log Channels 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the log channels for your application. Out of 26 | | the box, Laravel uses the Monolog PHP logging library. This gives 27 | | you a variety of powerful log handlers / formatters to utilize. 28 | | 29 | | Available Drivers: "single", "daily", "slack", "syslog", 30 | | "errorlog", "monolog", 31 | | "custom", "stack" 32 | | 33 | */ 34 | 35 | 'channels' => [ 36 | 'stack' => [ 37 | 'driver' => 'stack', 38 | 'channels' => ['single'], 39 | ], 40 | 41 | 'single' => [ 42 | 'driver' => 'single', 43 | 'path' => storage_path('logs/laravel.log'), 44 | 'level' => 'debug', 45 | ], 46 | 47 | 'daily' => [ 48 | 'driver' => 'daily', 49 | 'path' => storage_path('logs/laravel.log'), 50 | 'level' => 'debug', 51 | 'days' => 7, 52 | ], 53 | 54 | 'slack' => [ 55 | 'driver' => 'slack', 56 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 57 | 'username' => 'Laravel Log', 58 | 'emoji' => ':boom:', 59 | 'level' => 'critical', 60 | ], 61 | 62 | 'stderr' => [ 63 | 'driver' => 'monolog', 64 | 'handler' => StreamHandler::class, 65 | 'with' => [ 66 | 'stream' => 'php://stderr', 67 | ], 68 | ], 69 | 70 | 'syslog' => [ 71 | 'driver' => 'syslog', 72 | 'level' => 'debug', 73 | ], 74 | 75 | 'errorlog' => [ 76 | 'driver' => 'errorlog', 77 | 'level' => 'debug', 78 | ], 79 | ], 80 | 81 | ]; 82 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', '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 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => env('SQS_KEY', 'your-public-key'), 54 | 'secret' => env('SQS_SECRET', 'your-secret-key'), 55 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 56 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 57 | 'region' => env('SQS_REGION', 'us-east-1'), 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'retry_after' => 90, 65 | 'block_for' => null, 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Failed Queue Jobs 73 | |-------------------------------------------------------------------------- 74 | | 75 | | These options configure the behavior of failed queue job logging so you 76 | | can control which database and table are used to store the jobs that 77 | | have failed. You may change them to any database / table you wish. 78 | | 79 | */ 80 | 81 | 'failed' => [ 82 | 'database' => env('DB_CONNECTION', 'mysql'), 83 | 'table' => 'failed_jobs', 84 | ], 85 | 86 | ]; 87 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => env('SES_REGION', 'us-east-1'), 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle before it expires. If you want them 28 | | to immediately expire on the browser closing, set that option. 29 | | 30 | */ 31 | 32 | 'lifetime' => env('SESSION_LIFETIME', 120), 33 | 34 | 'expire_on_close' => false, 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Session Encryption 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This option allows you to easily specify that all of your session data 42 | | should be encrypted before it is stored. All encryption will be run 43 | | automatically by Laravel and you can use the Session like normal. 44 | | 45 | */ 46 | 47 | 'encrypt' => false, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Session File Location 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When using the native session driver, we need a location where session 55 | | files may be stored. A default has been set for you but a different 56 | | location may be specified. This is only needed for file sessions. 57 | | 58 | */ 59 | 60 | 'files' => storage_path('framework/sessions'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Database Connection 65 | |-------------------------------------------------------------------------- 66 | | 67 | | When using the "database" or "redis" session drivers, you may specify a 68 | | connection that should be used to manage these sessions. This should 69 | | correspond to a connection in your database configuration options. 70 | | 71 | */ 72 | 73 | 'connection' => null, 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Session Database Table 78 | |-------------------------------------------------------------------------- 79 | | 80 | | When using the "database" session driver, you may specify the table we 81 | | should use to manage the sessions. Of course, a sensible default is 82 | | provided for you; however, you are free to change this as needed. 83 | | 84 | */ 85 | 86 | 'table' => 'sessions', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Session Cache Store 91 | |-------------------------------------------------------------------------- 92 | | 93 | | When using the "apc" or "memcached" session drivers, you may specify a 94 | | cache store that should be used for these sessions. This value must 95 | | correspond with one of the application's configured cache stores. 96 | | 97 | */ 98 | 99 | 'store' => null, 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Session Sweeping Lottery 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Some session drivers must manually sweep their storage location to get 107 | | rid of old sessions from storage. Here are the chances that it will 108 | | happen on a given request. By default, the odds are 2 out of 100. 109 | | 110 | */ 111 | 112 | 'lottery' => [2, 100], 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Session Cookie Name 117 | |-------------------------------------------------------------------------- 118 | | 119 | | Here you may change the name of the cookie used to identify a session 120 | | instance by ID. The name specified here will get used every time a 121 | | new session cookie is created by the framework for every driver. 122 | | 123 | */ 124 | 125 | 'cookie' => env( 126 | 'SESSION_COOKIE', 127 | str_slug(env('APP_NAME', 'laravel'), '_').'_session' 128 | ), 129 | 130 | /* 131 | |-------------------------------------------------------------------------- 132 | | Session Cookie Path 133 | |-------------------------------------------------------------------------- 134 | | 135 | | The session cookie path determines the path for which the cookie will 136 | | be regarded as available. Typically, this will be the root path of 137 | | your application but you are free to change this when necessary. 138 | | 139 | */ 140 | 141 | 'path' => '/', 142 | 143 | /* 144 | |-------------------------------------------------------------------------- 145 | | Session Cookie Domain 146 | |-------------------------------------------------------------------------- 147 | | 148 | | Here you may change the domain of the cookie used to identify a session 149 | | in your application. This will determine which domains the cookie is 150 | | available to in your application. A sensible default has been set. 151 | | 152 | */ 153 | 154 | 'domain' => env('SESSION_DOMAIN', null), 155 | 156 | /* 157 | |-------------------------------------------------------------------------- 158 | | HTTPS Only Cookies 159 | |-------------------------------------------------------------------------- 160 | | 161 | | By setting this option to true, session cookies will only be sent back 162 | | to the server if the browser has a HTTPS connection. This will keep 163 | | the cookie from being sent to you if it can not be done securely. 164 | | 165 | */ 166 | 167 | 'secure' => env('SESSION_SECURE_COOKIE', false), 168 | 169 | /* 170 | |-------------------------------------------------------------------------- 171 | | HTTP Access Only 172 | |-------------------------------------------------------------------------- 173 | | 174 | | Setting this value to true will prevent JavaScript from accessing the 175 | | value of the cookie and the cookie will only be accessible through 176 | | the HTTP protocol. You are free to modify this option if needed. 177 | | 178 | */ 179 | 180 | 'http_only' => true, 181 | 182 | /* 183 | |-------------------------------------------------------------------------- 184 | | Same-Site Cookies 185 | |-------------------------------------------------------------------------- 186 | | 187 | | This option determines how your cookies behave when cross-site requests 188 | | take place, and can be used to mitigate CSRF attacks. By default, we 189 | | do not enable this as other CSRF protection services are in place. 190 | | 191 | | Supported: "lax", "strict" 192 | | 193 | */ 194 | 195 | 'same_site' => null, 196 | 197 | ]; 198 | -------------------------------------------------------------------------------- /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' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(App\Models\User::class, function (Faker $faker) { 17 | return [ 18 | 'name' => $faker->name, 19 | 'email' => $faker->unique()->safeEmail, 20 | 'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret 21 | 'confirmation_token' => str_random(32), 22 | 'remember_token' => str_random(10), 23 | 'confirmed' => false, 24 | ]; 25 | }); 26 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->string('password'); 21 | $table->boolean('confirmed')->default(false); 22 | $table->string('confirmation_token', 32)->nullable()->unique(); 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 | $table->timestamp('expires_at')->nullable(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('password_resets'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 5 | "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "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", 7 | "prod": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 8 | "test": "jest", 9 | "test:watch": "jest --watchAll", 10 | "lint": "eslint resources/assets/js --ext='.js,.vue'", 11 | "lint:fix": "eslint resources/assets/js --ext='.js,.vue' --fix" 12 | }, 13 | "jest": { 14 | "moduleFileExtensions": [ 15 | "js", 16 | "json", 17 | "vue" 18 | ], 19 | "testPathIgnorePatterns": [ 20 | "/resources/assets/js/__tests__/utils/" 21 | ], 22 | "transform": { 23 | ".*\\.(vue)$": "/node_modules/vue-jest", 24 | "^.+\\.js$": "/node_modules/babel-jest" 25 | }, 26 | "moduleNameMapper": { 27 | "^@/(.*)$": "/resources/assets/js/$1" 28 | } 29 | }, 30 | "devDependencies": { 31 | "@vue/test-utils": "^1.0.0-beta.21", 32 | "babel-eslint": "^8.2.6", 33 | "babel-jest": "^23.4.2", 34 | "babel-plugin-syntax-dynamic-import": "^6.18.0", 35 | "babel-plugin-transform-async-to-generator": "^6.24.1", 36 | "babel-plugin-transform-object-rest-spread": "^6.26.0", 37 | "babel-plugin-transform-runtime": "^6.23.0", 38 | "babel-polyfill": "^6.26.0", 39 | "babel-preset-env": "^1.7.0", 40 | "cross-env": "^5.2.0", 41 | "eslint": "^5.2.0", 42 | "eslint-config-standard": "^11.0.0", 43 | "eslint-plugin-import": "^2.13.0", 44 | "eslint-plugin-node": "^7.0.1", 45 | "eslint-plugin-promise": "^3.8.0", 46 | "eslint-plugin-standard": "^3.1.0", 47 | "eslint-plugin-vue": "^4.7.1", 48 | "flush-promises": "^1.0.0", 49 | "jest": "^23.4.2", 50 | "laravel-mix": "^2.1.11", 51 | "laravel-mix-purgecss": "^2.2.0", 52 | "tailwindcss": "^0.6.4", 53 | "vue-eslint-parser": "^3.2.2", 54 | "vue-jest": "^2.6.0" 55 | }, 56 | "dependencies": { 57 | "axios": "^0.18.0", 58 | "es6-promise": "^4.2.4", 59 | "local-storage": "^1.4.2", 60 | "vue": "^2.5.16", 61 | "vue-router": "^3.0.1", 62 | "vuex": "^3.0.1" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | ./tests/Unit 16 | 17 | 18 | 19 | ./tests/Feature 20 | 21 | 22 | 23 | 24 | ./app 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /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/0.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{Dd8w:function(e,t,s){"use strict";t.__esModule=!0;var r,a=s("woOf"),n=(r=a)&&r.__esModule?r:{default:r};t.default=n.default||function(e){for(var t=1;t1}},[e._v("× "+e._s(t))])})):e._e(),e._v(" "),r("form",{on:{submit:function(t){return t.preventDefault(),e.registerUser(t)}}},[r("input",{directives:[{name:"model",rawName:"v-model",value:e.user.name,expression:"user.name"}],staticClass:"text-input text-input-primary w-full mb-4",attrs:{type:"text",placeholder:"Full Name"},domProps:{value:e.user.name},on:{input:function(t){t.target.composing||e.$set(e.user,"name",t.target.value)}}}),e._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:e.user.email,expression:"user.email"}],staticClass:"text-input text-input-primary w-full mb-4",attrs:{type:"email",placeholder:"Email"},domProps:{value:e.user.email},on:{input:function(t){t.target.composing||e.$set(e.user,"email",t.target.value)}}}),e._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:e.user.password,expression:"user.password"}],staticClass:"text-input text-input-primary w-full mb-4",attrs:{type:"password",placeholder:"Password"},domProps:{value:e.user.password},on:{input:function(t){t.target.composing||e.$set(e.user,"password",t.target.value)}}}),e._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:e.user.password_confirmation,expression:"user.password_confirmation"}],staticClass:"text-input text-input-primary w-full mb-4",attrs:{type:"password",placeholder:"Confirm Password"},domProps:{value:e.user.password_confirmation},on:{input:function(t){t.target.composing||e.$set(e.user,"password_confirmation",t.target.value)}}}),e._v(" "),r("button",{staticClass:"btn btn-primary w-full h-10",attrs:{disabled:e.submitDisabled,type:"submit"}},[e._v("Sign Up")])])]),e._v(" "),r("p",{staticClass:"text-white mt-4 uppercase tracking-wide font-bold text-xs"},[e._v("Have an account already? "),r("router-link",{staticClass:"text-white",attrs:{to:{name:"Login"}}},[e._v("Sign In")])],1)])},staticRenderFns:[]}}}); -------------------------------------------------------------------------------- /public/2.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([2],{"92+x":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=r("Xxa5"),n=r.n(s),o=r("exGp"),a=r.n(o),i=r("Dd8w"),u=r.n(i),l=r("fZjL"),c=r.n(l),d=r("NYxO");t.default={name:"NewPassword",data:function(){return{successfullyReset:!1,user:{password:"",password_confirmation:"",token:""},errors:[]}},computed:{submitDisabled:function(){var e=this;return c()(this.user).some(function(t){return""===e.user[t].trim()})}},mounted:function(){this.user.token=this.$route.query.token},methods:u()({},Object(d.b)(["resetPassword"]),{resetUserPassword:function(){var e=this;return a()(n.a.mark(function t(){return n.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.resetPassword(e.user);case 3:e.errors=[],e.successfullyReset=!0,t.next=11;break;case 7:t.prev=7,t.t0=t.catch(0),e.errors=[],t.t0.hasOwnProperty("error")?e.errors.push(t.t0.error):c()(t.t0.errors).forEach(function(r){"token"===r?e.errors.push("An invalid or nonexistent reset token was given"):e.errors.push(t.t0.errors[r][0])});case 11:case"end":return t.stop()}},t,e,[[0,7]])}))()}})}},Dd8w:function(e,t,r){"use strict";t.__esModule=!0;var s,n=r("woOf"),o=(s=n)&&s.__esModule?s:{default:s};t.default=o.default||function(e){for(var t=1;t1}},[e._v("× "+e._s(t))])})):e._e(),e._v(" "),e.successfullyReset?r("div",[r("p",{staticClass:"text-grey-dark leading-loose"},[e._v("Your password has been reset. You can now "),r("router-link",{attrs:{to:{name:"Login"}}},[e._v("sign in")]),e._v(" with your new password.")],1)]):r("div",[r("form",{on:{submit:function(t){return t.preventDefault(),e.resetUserPassword(t)}}},[r("input",{directives:[{name:"model",rawName:"v-model",value:e.user.password,expression:"user.password"}],staticClass:"text-input text-input-primary w-full mb-4",attrs:{type:"password",placeholder:"Password"},domProps:{value:e.user.password},on:{input:function(t){t.target.composing||e.$set(e.user,"password",t.target.value)}}}),e._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:e.user.password_confirmation,expression:"user.password_confirmation"}],staticClass:"text-input text-input-primary w-full mb-4",attrs:{type:"password",placeholder:"Confirm Password"},domProps:{value:e.user.password_confirmation},on:{input:function(t){t.target.composing||e.$set(e.user,"password_confirmation",t.target.value)}}}),e._v(" "),r("button",{staticClass:"btn btn-primary w-full h-10",attrs:{disabled:e.submitDisabled,type:"submit"}},[e._v("Reset Password")]),e._v(" "),r("p",{staticClass:"mt-4 text-center"},[r("router-link",{staticClass:"text-xs text-blue font-bold no-underline",attrs:{to:{name:"Login"}}},[e._v("Back to Sign In")])],1)])])])])},staticRenderFns:[]}}}); -------------------------------------------------------------------------------- /public/3.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([3],{"9M4/":function(e,t,r){var s=r("VU/8")(r("jVAB"),r("KP9D"),!1,null,null,null);e.exports=s.exports},Dd8w:function(e,t,r){"use strict";t.__esModule=!0;var s,a=r("woOf"),n=(s=a)&&s.__esModule?s:{default:s};t.default=n.default||function(e){for(var t=1;t 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/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js?id=b55fc68156a0c0812d26", 3 | "/css/app.css": "/css/app.css?id=7e50815fb348e9f189da" 4 | } -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/assets/js/__tests__/store/client.test.js: -------------------------------------------------------------------------------- 1 | import client from '@/store/client' 2 | import axios from 'axios' 3 | import '@/router' 4 | 5 | jest.mock('axios', () => { 6 | const moxios = jest.fn(() => Promise.resolve({ data: { username: 'syropian' } })) 7 | moxios.defaults = { 8 | headers: { 9 | common: { 10 | 'X-Request-With': 'XMLHttpRequest' 11 | } 12 | } 13 | } 14 | return moxios 15 | }) 16 | 17 | jest.mock('@/router', () => { 18 | return jest.fn() 19 | }) 20 | 21 | describe('HTTP Client', () => { 22 | beforeEach(() => { 23 | jest.resetModules() 24 | jest.clearAllMocks() 25 | }) 26 | 27 | it('can enable an authorized request', () => { 28 | client.withAuth() 29 | expect(client.auth).toBe(true) 30 | }) 31 | 32 | it('can enable an unauthorized request', () => { 33 | client.withoutAuth() 34 | expect(client.auth).toBe(false) 35 | }) 36 | 37 | it('sends a request', async () => { 38 | const res = await client.get('/user') 39 | expect(axios).toHaveBeenCalled() 40 | expect(res).toEqual({ username: 'syropian' }) 41 | }) 42 | }) 43 | -------------------------------------------------------------------------------- /resources/assets/js/__tests__/store/modules/user.test.js: -------------------------------------------------------------------------------- 1 | import user from '@/store/modules/user' 2 | import client from '@/store/client' 3 | import ls from 'local-storage' 4 | 5 | jest.mock('@/store/client') 6 | jest.mock('local-storage') 7 | 8 | const state = { ...user.state } 9 | const getters = user.getters 10 | const { SET_USER } = user.mutations 11 | const { fetchUser } = user.actions 12 | const ctx = { commit: jest.fn() } 13 | 14 | describe('User Module', () => { 15 | beforeEach(() => { 16 | jest.resetModules() 17 | jest.clearAllMocks() 18 | }) 19 | 20 | describe('User state', () => { 21 | it('returns the user-related state', () => { 22 | expect(state).toEqual({ user: {} }) 23 | }) 24 | }) 25 | 26 | describe('User getters', () => { 27 | it('returns the user', () => { 28 | expect(getters.user(state)).toEqual(state.user) 29 | 30 | ls.mockReturnValueOnce('abcde12345') 31 | expect(getters.isAuthenticated(state)).toBe(true) 32 | ls.mockReturnValueOnce('') 33 | expect(getters.isAuthenticated(state)).toBe(false) 34 | }) 35 | }) 36 | 37 | describe('User mutations', () => { 38 | it('sets the user object', () => { 39 | const newUser = { 40 | username: 'syropian' 41 | } 42 | 43 | SET_USER(state, newUser) 44 | 45 | expect(state.user).toEqual(newUser) 46 | }) 47 | }) 48 | 49 | describe('User actions', () => { 50 | it('fetches the authenticated user', async () => { 51 | const res = { username: 'syropian' } 52 | client.get.mockResolvedValue(res) 53 | 54 | await fetchUser(ctx) 55 | 56 | expect(client.withAuth).toHaveBeenCalled() 57 | expect(client.get).toHaveBeenCalledWith('/api/auth/me') 58 | expect(ctx.commit).toHaveBeenCalledWith('SET_USER', res) 59 | }) 60 | }) 61 | }) 62 | -------------------------------------------------------------------------------- /resources/assets/js/app.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from '@/components/App' 3 | import router from '@/router' 4 | import store from '@/store' 5 | 6 | Vue.config.productionTip = false 7 | 8 | Object.defineProperty(Vue.prototype, '$bus', { 9 | get () { 10 | return this.$root.bus 11 | } 12 | }) 13 | 14 | /* eslint-disable no-new */ 15 | const bus = new Vue({}) 16 | 17 | new Vue({ 18 | el: '#app', 19 | data: { 20 | bus 21 | }, 22 | router, 23 | store, 24 | render: h => h(App) 25 | }) 26 | -------------------------------------------------------------------------------- /resources/assets/js/components/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 11 | 16 | -------------------------------------------------------------------------------- /resources/assets/js/pages/ConfirmEmail.vue: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /resources/assets/js/pages/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 13 | 22 | -------------------------------------------------------------------------------- /resources/assets/js/pages/EmailConfirmed.vue: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /resources/assets/js/pages/Index.vue: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /resources/assets/js/pages/Login.vue: -------------------------------------------------------------------------------- 1 | 37 | 70 | -------------------------------------------------------------------------------- /resources/assets/js/pages/NewPassword.vue: -------------------------------------------------------------------------------- 1 | 46 | 94 | -------------------------------------------------------------------------------- /resources/assets/js/pages/Register.vue: -------------------------------------------------------------------------------- 1 | 50 | 91 | -------------------------------------------------------------------------------- /resources/assets/js/pages/ResetPassword.vue: -------------------------------------------------------------------------------- 1 | 35 | 62 | -------------------------------------------------------------------------------- /resources/assets/js/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import ls from 'local-storage' 4 | import store from '@/store' 5 | 6 | const Index = () => import('@/pages/Index') 7 | const Login = () => import('@/pages/Login') 8 | const Register = () => import('@/pages/Register') 9 | const ConfirmEmail = () => import('@/pages/ConfirmEmail') 10 | const EmailConfirmed = () => import('@/pages/EmailConfirmed') 11 | const ResetPassword = () => import('@/pages/ResetPassword') 12 | const NewPassword = () => import('@/pages/NewPassword') 13 | const Dashboard = () => import('@/pages/Dashboard') 14 | 15 | Vue.use(Router) 16 | 17 | const userIsConfirmed = async () => { 18 | if (!Object.keys(store.getters.user).length) { 19 | await store.dispatch('fetchUser') 20 | } 21 | return store.getters.user.confirmed 22 | } 23 | 24 | const router = new Router({ 25 | mode: 'history', 26 | routes: [ 27 | { 28 | path: '*', 29 | redirect: '/index' 30 | }, 31 | { 32 | path: '/login', 33 | name: 'Login', 34 | component: Login 35 | }, 36 | { 37 | path: '/register', 38 | name: 'Register', 39 | component: Register 40 | }, 41 | { 42 | path: '/confirm-email', 43 | name: 'ConfirmEmail', 44 | component: ConfirmEmail, 45 | meta: { 46 | requiresAuth: true 47 | }, 48 | beforeEnter: async (to, from, next) => { 49 | if (await userIsConfirmed()) { 50 | next('dashboard') 51 | } else { 52 | next() 53 | } 54 | } 55 | }, 56 | { 57 | path: '/email-confirmed', 58 | name: 'EmailConfirmed', 59 | component: EmailConfirmed, 60 | meta: { 61 | requiresAuth: true, 62 | requiresConfirmation: true 63 | } 64 | }, 65 | { 66 | path: '/logout', 67 | name: 'Logout', 68 | meta: { 69 | requiresAuth: true 70 | }, 71 | beforeEnter: (to, from, next) => { 72 | ls.clear() 73 | next('login') 74 | } 75 | }, 76 | { 77 | path: '/reset-password', 78 | name: 'ResetPassword', 79 | component: ResetPassword 80 | }, 81 | { 82 | path: '/new-password', 83 | name: 'NewPassword', 84 | component: NewPassword 85 | }, 86 | { 87 | path: '/index', 88 | name: 'Index', 89 | component: Index 90 | }, 91 | { 92 | path: '/dashboard', 93 | name: 'Dashboard', 94 | component: Dashboard, 95 | meta: { 96 | requiresAuth: true, 97 | requiresConfirmation: true 98 | } 99 | } 100 | ] 101 | }) 102 | 103 | router.beforeEach(async (to, from, next) => { 104 | const token = ls('jwt') 105 | const expiry = ls('jwt_expiry') 106 | const requiresAuth = to.matched.some(record => record.meta.requiresAuth) 107 | const requiresConfirmation = to.matched.some( 108 | record => record.meta.requiresConfirmation 109 | ) 110 | if (requiresAuth && !token) { 111 | // Requires auth, user has no token 112 | next('login') 113 | } else if (requiresAuth && token && new Date() > new Date(expiry)) { 114 | // Requires auth, user has expired token 115 | next('login') 116 | } else if (!requiresAuth && token && new Date() < new Date(expiry)) { 117 | // Doesn't requires auth, user has valid token 118 | next('dashboard') 119 | } else { 120 | if (requiresConfirmation) { 121 | if (await userIsConfirmed()) { 122 | next() 123 | } else { 124 | next('confirm-email') 125 | } 126 | } else { 127 | next() 128 | } 129 | } 130 | }) 131 | 132 | export default router 133 | -------------------------------------------------------------------------------- /resources/assets/js/store/client/__mocks__/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | export default { 3 | auth: false, 4 | withAuth: jest.fn().mockReturnThis(), 5 | withoutAuth: jest.fn().mockReturnThis(), 6 | get: jest.fn(() => Promise.resolve({})), 7 | post: jest.fn(() => Promise.resolve({})), 8 | put: jest.fn(() => Promise.resolve({})), 9 | patch: jest.fn(() => Promise.resolve({})), 10 | delete: jest.fn(() => Promise.resolve({})) 11 | } 12 | -------------------------------------------------------------------------------- /resources/assets/js/store/client/index.js: -------------------------------------------------------------------------------- 1 | import { Promise } from 'es6-promise' 2 | import axios from 'axios' 3 | import ls from 'local-storage' 4 | import router from '@/router' 5 | 6 | axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' 7 | 8 | const verbs = ['get', 'post', 'put', 'patch', 'delete'] 9 | 10 | const client = { 11 | auth: false, 12 | withAuth () { 13 | client.auth = true 14 | return client 15 | }, 16 | withoutAuth () { 17 | client.auth = false 18 | return client 19 | } 20 | } 21 | 22 | verbs.forEach(verb => { 23 | client[verb] = (url, data = {}, headers = {}) => { 24 | return new Promise((resolve, reject) => { 25 | return axios({ 26 | method: verb, 27 | url, 28 | data, 29 | headers: 30 | client.auth && ls('jwt') ? Object.assign({}, { Authorization: `Bearer ${ls('jwt')}` }, headers) : headers 31 | }) 32 | .then(res => { 33 | client.auth = false 34 | resolve(res.data) 35 | }) 36 | .catch(error => { 37 | client.auth = false 38 | if (error.response.status === 401) { 39 | router.push('logout') 40 | } 41 | reject(error.response.data) 42 | }) 43 | }) 44 | } 45 | }) 46 | 47 | export default client 48 | -------------------------------------------------------------------------------- /resources/assets/js/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import user from './modules/user' 4 | 5 | Vue.use(Vuex) 6 | 7 | export default new Vuex.Store({ 8 | modules: { 9 | user 10 | } 11 | }) 12 | -------------------------------------------------------------------------------- /resources/assets/js/store/modules/user.js: -------------------------------------------------------------------------------- 1 | import ls from 'local-storage' 2 | import { SET_USER } from '@/store/mutation-types' 3 | import client from '@/store/client' 4 | 5 | const state = { 6 | user: {} 7 | } 8 | 9 | const getters = { 10 | user: state => state.user, 11 | isAuthenticated: state => 12 | !!ls('jwt') && new Date() < new Date(ls('jwt_expiry')) 13 | } 14 | 15 | const mutations = { 16 | [SET_USER] (state, user) { 17 | state.user = user 18 | } 19 | } 20 | 21 | const actions = { 22 | register ({ dispatch, commit }, user) { 23 | return client 24 | .withoutAuth() 25 | .post('/api/users', user) 26 | .then(() => { 27 | return dispatch('login', { 28 | email: user.email, 29 | password: user.password 30 | }) 31 | }) 32 | }, 33 | login ({ commit }, credentials) { 34 | return client 35 | .withoutAuth() 36 | .post('/api/auth/login', credentials) 37 | .then(({ token, expiry, user }) => { 38 | const tokenExpiry = new Date() 39 | tokenExpiry.setSeconds(tokenExpiry.getSeconds() + parseInt(expiry, 10)) 40 | ls('jwt', token) 41 | ls('jwt_expiry', tokenExpiry) 42 | commit(SET_USER, user) 43 | }) 44 | }, 45 | fetchUser ({ commit }) { 46 | return client 47 | .withAuth() 48 | .get('/api/auth/me') 49 | .then(res => { 50 | commit(SET_USER, res) 51 | }) 52 | }, 53 | requestPasswordReset (__ctx, email) { 54 | return client.withoutAuth().post('/api/auth/request-password-reset', email) 55 | }, 56 | resetPassword (__ctx, password) { 57 | return client 58 | .withoutAuth() 59 | .put('/api/auth/request-password-reset', password) 60 | } 61 | } 62 | 63 | export default { 64 | state, 65 | getters, 66 | actions, 67 | mutations 68 | } 69 | -------------------------------------------------------------------------------- /resources/assets/js/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | export const SET_USER = 'SET_USER' 2 | -------------------------------------------------------------------------------- /resources/assets/styles/_animations.scss: -------------------------------------------------------------------------------- 1 | .fade-enter-active, 2 | .fade-leave-active { 3 | transition: opacity 250ms ease; 4 | } 5 | .fade-enter, 6 | .fade-leave-to { 7 | opacity: 0; 8 | } 9 | 10 | @keyframes spin { 11 | from { 12 | transform: rotate(0deg); 13 | } 14 | to { 15 | transform: rotate(360deg); 16 | } 17 | } 18 | 19 | .spin { 20 | animation: spin 1s infinite linear; 21 | } 22 | -------------------------------------------------------------------------------- /resources/assets/styles/_components.scss: -------------------------------------------------------------------------------- 1 | .btn { 2 | @apply transition-bg text-sm font-bold py-2 px-4 rounded no-underline; 3 | &-primary { 4 | @apply bg-blue text-white; 5 | &:hover { 6 | @apply bg-blue-dark; 7 | } 8 | } 9 | &-secondary { 10 | @apply bg-grey-light text-grey-darkest; 11 | &:hover { 12 | @apply bg-grey; 13 | } 14 | } 15 | &-danger { 16 | @apply bg-red text-white; 17 | &:hover { 18 | @apply bg-red-dark; 19 | } 20 | } 21 | } 22 | 23 | .text-input { 24 | @apply appearance-none bg-grey-lightest border-2 border-grey-light rounded py-2 px-4 text-grey-darker transition-color-bg-border; 25 | &:focus { 26 | @apply border-grey; 27 | outline: none; 28 | } 29 | &.text-input-primary { 30 | &:focus { 31 | @apply border-blue; 32 | outline: none; 33 | } 34 | } 35 | } 36 | 37 | .dropdown { 38 | @apply absolute pin-t pin-r rounded shadow z-10 overflow-hidden; 39 | > ul { 40 | @apply list-reset; 41 | .dropdown-item { 42 | @apply block cursor-pointer px-4 py-2 bg-white text-grey-darkest no-underline; 43 | &:hover { 44 | @apply bg-blue text-white; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resources/assets/styles/_custom-utilities.scss: -------------------------------------------------------------------------------- 1 | .bg-white-10 { 2 | background-color: rgba(#fff, 0.1); 3 | } 4 | 5 | .tracking-wider { 6 | letter-spacing: 0.08rem; 7 | } 8 | 9 | .focus-none:focus { 10 | outline: none; 11 | } 12 | 13 | .list-none { 14 | list-style-type: none; 15 | } 16 | 17 | .nudge-t { 18 | top: 1px; 19 | } 20 | 21 | .nudge-r { 22 | right: 1px; 23 | } 24 | 25 | .nudge-b { 26 | bottom: 1px; 27 | } 28 | 29 | .nudge-l { 30 | left: 1px; 31 | } 32 | 33 | .transition-bg { 34 | transition: background-color 150ms ease; 35 | } 36 | 37 | .transition-color { 38 | transition: color 150ms ease; 39 | } 40 | 41 | .transition-border-color { 42 | transition: border-color 150ms ease; 43 | } 44 | 45 | .transition-color-bg { 46 | transition: background-color 150ms ease, color 150ms ease; 47 | } 48 | 49 | .transition-color-bg-border { 50 | transition: background-color 150ms ease, color 150ms ease, 51 | border-color 150ms ease; 52 | } 53 | 54 | .transition-stroke { 55 | transition: stroke 150ms ease; 56 | } 57 | 58 | .transition-opacity { 59 | transition: opacity 150ms ease; 60 | } 61 | 62 | [disabled] { 63 | opacity: 0.5; 64 | pointer-events: none; 65 | } 66 | 67 | .indent-px { 68 | text-indent: 1px; 69 | } 70 | -------------------------------------------------------------------------------- /resources/assets/styles/app.scss: -------------------------------------------------------------------------------- 1 | @tailwind preflight; 2 | @import "components"; 3 | @tailwind utilities; 4 | 5 | html, 6 | body { 7 | overflow: auto; 8 | -webkit-overflow-scrolling: touch; 9 | position: relative; 10 | } 11 | body { 12 | background: config("colors.brand"); 13 | font-family: config("fonts.sans"); 14 | min-height: 100vh; 15 | } 16 | 17 | @import "animations"; 18 | @import "custom-utilities"; 19 | -------------------------------------------------------------------------------- /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 six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/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_format' => 'The :attribute does not match the format :format.', 36 | 'different' => 'The :attribute and :other must be different.', 37 | 'digits' => 'The :attribute must be :digits digits.', 38 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 39 | 'dimensions' => 'The :attribute has invalid image dimensions.', 40 | 'distinct' => 'The :attribute field has a duplicate value.', 41 | 'email' => 'The :attribute must be a valid email address.', 42 | 'exists' => 'The selected :attribute is invalid.', 43 | 'file' => 'The :attribute must be a file.', 44 | 'filled' => 'The :attribute field must have a value.', 45 | 'gt' => [ 46 | 'numeric' => 'The :attribute must be greater than :value.', 47 | 'file' => 'The :attribute must be greater than :value kilobytes.', 48 | 'string' => 'The :attribute must be greater than :value characters.', 49 | 'array' => 'The :attribute must have more than :value items.', 50 | ], 51 | 'gte' => [ 52 | 'numeric' => 'The :attribute must be greater than or equal :value.', 53 | 'file' => 'The :attribute must be greater than or equal :value kilobytes.', 54 | 'string' => 'The :attribute must be greater than or equal :value characters.', 55 | 'array' => 'The :attribute must have :value items or more.', 56 | ], 57 | 'image' => 'The :attribute must be an image.', 58 | 'in' => 'The selected :attribute is invalid.', 59 | 'in_array' => 'The :attribute field does not exist in :other.', 60 | 'integer' => 'The :attribute must be an integer.', 61 | 'ip' => 'The :attribute must be a valid IP address.', 62 | 'ipv4' => 'The :attribute must be a valid IPv4 address.', 63 | 'ipv6' => 'The :attribute must be a valid IPv6 address.', 64 | 'json' => 'The :attribute must be a valid JSON string.', 65 | 'lt' => [ 66 | 'numeric' => 'The :attribute must be less than :value.', 67 | 'file' => 'The :attribute must be less than :value kilobytes.', 68 | 'string' => 'The :attribute must be less than :value characters.', 69 | 'array' => 'The :attribute must have less than :value items.', 70 | ], 71 | 'lte' => [ 72 | 'numeric' => 'The :attribute must be less than or equal :value.', 73 | 'file' => 'The :attribute must be less than or equal :value kilobytes.', 74 | 'string' => 'The :attribute must be less than or equal :value characters.', 75 | 'array' => 'The :attribute must not have more than :value items.', 76 | ], 77 | 'max' => [ 78 | 'numeric' => 'The :attribute may not be greater than :max.', 79 | 'file' => 'The :attribute may not be greater than :max kilobytes.', 80 | 'string' => 'The :attribute may not be greater than :max characters.', 81 | 'array' => 'The :attribute may not have more than :max items.', 82 | ], 83 | 'mimes' => 'The :attribute must be a file of type: :values.', 84 | 'mimetypes' => 'The :attribute must be a file of type: :values.', 85 | 'min' => [ 86 | 'numeric' => 'The :attribute must be at least :min.', 87 | 'file' => 'The :attribute must be at least :min kilobytes.', 88 | 'string' => 'The :attribute must be at least :min characters.', 89 | 'array' => 'The :attribute must have at least :min items.', 90 | ], 91 | 'not_in' => 'The selected :attribute is invalid.', 92 | 'not_regex' => 'The :attribute format is invalid.', 93 | 'numeric' => 'The :attribute must be a number.', 94 | 'present' => 'The :attribute field must be present.', 95 | 'regex' => 'The :attribute format is invalid.', 96 | 'required' => 'The :attribute field is required.', 97 | 'required_if' => 'The :attribute field is required when :other is :value.', 98 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 99 | 'required_with' => 'The :attribute field is required when :values is present.', 100 | 'required_with_all' => 'The :attribute field is required when :values is present.', 101 | 'required_without' => 'The :attribute field is required when :values is not present.', 102 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 103 | 'same' => 'The :attribute and :other must match.', 104 | 'size' => [ 105 | 'numeric' => 'The :attribute must be :size.', 106 | 'file' => 'The :attribute must be :size kilobytes.', 107 | 'string' => 'The :attribute must be :size characters.', 108 | 'array' => 'The :attribute must contain :size items.', 109 | ], 110 | 'string' => 'The :attribute must be a string.', 111 | 'timezone' => 'The :attribute must be a valid zone.', 112 | 'unique' => 'The :attribute has already been taken.', 113 | 'uploaded' => 'The :attribute failed to upload.', 114 | 'url' => 'The :attribute format is invalid.', 115 | 116 | /* 117 | |-------------------------------------------------------------------------- 118 | | Custom Validation Language Lines 119 | |-------------------------------------------------------------------------- 120 | | 121 | | Here you may specify custom validation messages for attributes using the 122 | | convention "attribute.rule" to name the lines. This makes it quick to 123 | | specify a specific custom language line for a given attribute rule. 124 | | 125 | */ 126 | 127 | 'custom' => [ 128 | 'attribute-name' => [ 129 | 'rule-name' => 'custom-message', 130 | ], 131 | ], 132 | 133 | /* 134 | |-------------------------------------------------------------------------- 135 | | Custom Validation Attributes 136 | |-------------------------------------------------------------------------- 137 | | 138 | | The following language lines are used to swap attribute place-holders 139 | | with something more reader friendly such as E-Mail Address instead 140 | | of "email". This simply helps us make messages a little cleaner. 141 | | 142 | */ 143 | 144 | 'attributes' => [], 145 | 146 | ]; 147 | -------------------------------------------------------------------------------- /resources/views/emails/confirm-email.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | # One Last Step 3 | 4 | Hey, thanks for checking out MyApp! We just need to confirm your email address so we know you're human. Clicking that button below will do the trick. 5 | 6 | @component('mail::button', ['url' => url('/api/users/confirm?token=' . $user->confirmation_token)]) 7 | Confirm Email 8 | @endcomponent 9 | 10 | Thanks,
11 | {{ config('app.name') }} 12 | @endcomponent 13 | -------------------------------------------------------------------------------- /resources/views/emails/password-reset-request.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | # Reset Your Password 3 | 4 | We heard you need a password reset. Click the link below and you'll be redirected to a secure page from which you can set a new password. 5 | 6 | @component('mail::button', ['url' => url('/new-password?token=' . $token)]) 7 | Reset Password 8 | @endcomponent 9 | 10 | If you didn't mean to reset your password, then you can just ignore this email; your password will not change. 11 | 12 | Thanks,
13 | {{ config('app.name') }} 14 | @endcomponent 15 | -------------------------------------------------------------------------------- /resources/views/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Welcome to MyApp! 10 | 11 | 12 | 13 | 14 | 15 |
16 | @if(isset($email_confirmed)) 17 | 20 | @endif 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | middleware('throttle:100,5'); 23 | Route::put('/auth/request-password-reset', 'PasswordResetController@update'); 24 | 25 | Route::post('users', 'UserController@store'); 26 | Route::get('/users/confirm', 'UserConfirmationController'); 27 | -------------------------------------------------------------------------------- /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 | where('vue_capture', '[\/\w\.-]*'); 17 | 18 | Auth::routes(); 19 | 20 | Route::get('/home', 'HomeController@index')->name('home'); 21 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /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 | !.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 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Tailwind - The Utility-First CSS Framework 4 | 5 | A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink), 6 | David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger). 7 | 8 | Welcome to the Tailwind config file. This is where you can customize 9 | Tailwind specifically for your project. Don't be intimidated by the 10 | length of this file. It's really just a big JavaScript object and 11 | we've done our very best to explain each section. 12 | 13 | View the full documentation at https://tailwindcss.com. 14 | 15 | |------------------------------------------------------------------------------- 16 | | The default config 17 | |------------------------------------------------------------------------------- 18 | | 19 | | This variable contains the default Tailwind config. You don't have 20 | | to use it, but it can sometimes be helpful to have available. For 21 | | example, you may choose to merge your custom configuration 22 | | values with some of the Tailwind defaults. 23 | | 24 | */ 25 | 26 | // let defaultConfig = require('tailwindcss/defaultConfig')() 27 | 28 | /* 29 | |------------------------------------------------------------------------------- 30 | | Colors https://tailwindcss.com/docs/colors 31 | |------------------------------------------------------------------------------- 32 | | 33 | | Here you can specify the colors used in your project. To get you started, 34 | | we've provided a generous palette of great looking colors that are perfect 35 | | for prototyping, but don't hesitate to change them for your project. You 36 | | own these colors, nothing will break if you change everything about them. 37 | | 38 | | We've used literal color names ("red", "blue", etc.) for the default 39 | | palette, but if you'd rather use functional names like "primary" and 40 | | "secondary", or even a numeric scale like "100" and "200", go for it. 41 | | 42 | */ 43 | 44 | let colors = { 45 | transparent: 'transparent', 46 | 47 | black: '#22292f', 48 | 'grey-darkest': '#3d4852', 49 | 'grey-darker': '#606f7b', 50 | 'grey-dark': '#8795a1', 51 | grey: '#b8c2cc', 52 | 'grey-light': '#dae1e7', 53 | 'grey-lighter': '#f1f5f8', 54 | 'grey-lightest': '#f8fafc', 55 | white: '#ffffff', 56 | 57 | 'red-darkest': '#3b0d0c', 58 | 'red-darker': '#621b18', 59 | 'red-dark': '#cc1f1a', 60 | red: '#e3342f', 61 | 'red-light': '#ef5753', 62 | 'red-lighter': '#f9acaa', 63 | 'red-lightest': '#fcebea', 64 | 65 | 'orange-darkest': '#462a16', 66 | 'orange-darker': '#613b1f', 67 | 'orange-dark': '#de751f', 68 | orange: '#f6993f', 69 | 'orange-light': '#faad63', 70 | 'orange-lighter': '#fcd9b6', 71 | 'orange-lightest': '#fff5eb', 72 | 73 | 'yellow-darkest': '#453411', 74 | 'yellow-darker': '#684f1d', 75 | 'yellow-dark': '#f2d024', 76 | yellow: '#ffed4a', 77 | 'yellow-light': '#fff382', 78 | 'yellow-lighter': '#fff9c2', 79 | 'yellow-lightest': '#fcfbeb', 80 | 81 | 'green-darkest': '#0f2f21', 82 | 'green-darker': '#1a4731', 83 | 'green-dark': '#1f9d55', 84 | green: '#38c172', 85 | 'green-light': '#51d88a', 86 | 'green-lighter': '#a2f5bf', 87 | 'green-lightest': '#e3fcec', 88 | 89 | 'teal-darkest': '#0d3331', 90 | 'teal-darker': '#20504f', 91 | 'teal-dark': '#38a89d', 92 | teal: '#4dc0b5', 93 | 'teal-light': '#64d5ca', 94 | 'teal-lighter': '#a0f0ed', 95 | 'teal-lightest': '#e8fffe', 96 | 97 | 'blue-darkest': '#12283a', 98 | 'blue-darker': '#1c3d5a', 99 | 'blue-dark': '#2779bd', 100 | blue: '#3490dc', 101 | 'blue-light': '#6cb2eb', 102 | 'blue-lighter': '#bcdefa', 103 | 'blue-lightest': '#eff8ff', 104 | 105 | 'indigo-darkest': '#191e38', 106 | 'indigo-darker': '#2f365f', 107 | 'indigo-dark': '#5661b3', 108 | indigo: '#6574cd', 109 | 'indigo-light': '#7886d7', 110 | 'indigo-lighter': '#b2b7ff', 111 | 'indigo-lightest': '#e6e8ff', 112 | 113 | 'purple-darkest': '#21183c', 114 | 'purple-darker': '#382b5f', 115 | 'purple-dark': '#794acf', 116 | purple: '#9561e2', 117 | 'purple-light': '#a779e9', 118 | 'purple-lighter': '#d6bbfc', 119 | 'purple-lightest': '#f3ebff', 120 | 121 | 'pink-darkest': '#451225', 122 | 'pink-darker': '#6f213f', 123 | 'pink-dark': '#eb5286', 124 | pink: '#f66d9b', 125 | 'pink-light': '#fa7ea8', 126 | 'pink-lighter': '#ffbbca', 127 | 'pink-lightest': '#ffebef' 128 | } 129 | 130 | module.exports = { 131 | /* 132 | |----------------------------------------------------------------------------- 133 | | Colors https://tailwindcss.com/docs/colors 134 | |----------------------------------------------------------------------------- 135 | | 136 | | The color palette defined above is also assigned to the "colors" key of 137 | | your Tailwind config. This makes it easy to access them in your CSS 138 | | using Tailwind's config helper. For example: 139 | | 140 | | .error { color: config('colors.red') } 141 | | 142 | */ 143 | 144 | colors: colors, 145 | 146 | /* 147 | |----------------------------------------------------------------------------- 148 | | Screens https://tailwindcss.com/docs/responsive-design 149 | |----------------------------------------------------------------------------- 150 | | 151 | | Screens in Tailwind are translated to CSS media queries. They define the 152 | | responsive breakpoints for your project. By default Tailwind takes a 153 | | "mobile first" approach, where each screen size represents a minimum 154 | | viewport width. Feel free to have as few or as many screens as you 155 | | want, naming them in whatever way you'd prefer for your project. 156 | | 157 | | Tailwind also allows for more complex screen definitions, which can be 158 | | useful in certain situations. Be sure to see the full responsive 159 | | documentation for a complete list of options. 160 | | 161 | | Class name: .{screen}:{utility} 162 | | 163 | */ 164 | 165 | screens: { 166 | sm: '576px', 167 | md: '768px', 168 | lg: '992px', 169 | xl: '1200px' 170 | }, 171 | 172 | /* 173 | |----------------------------------------------------------------------------- 174 | | Fonts https://tailwindcss.com/docs/fonts 175 | |----------------------------------------------------------------------------- 176 | | 177 | | Here is where you define your project's font stack, or font families. 178 | | Keep in mind that Tailwind doesn't actually load any fonts for you. 179 | | If you're using custom fonts you'll need to import them prior to 180 | | defining them here. 181 | | 182 | | By default we provide a native font stack that works remarkably well on 183 | | any device or OS you're using, since it just uses the default fonts 184 | | provided by the platform. 185 | | 186 | | Class name: .font-{name} 187 | | 188 | */ 189 | 190 | fonts: { 191 | sans: [ 192 | 'system-ui', 193 | 'BlinkMacSystemFont', 194 | '-apple-system', 195 | 'Segoe UI', 196 | 'Roboto', 197 | 'Oxygen', 198 | 'Ubuntu', 199 | 'Cantarell', 200 | 'Fira Sans', 201 | 'Droid Sans', 202 | 'Helvetica Neue', 203 | 'sans-serif' 204 | ], 205 | serif: [ 206 | 'Constantia', 207 | 'Lucida Bright', 208 | 'Lucidabright', 209 | 'Lucida Serif', 210 | 'Lucida', 211 | 'DejaVu Serif', 212 | 'Bitstream Vera Serif', 213 | 'Liberation Serif', 214 | 'Georgia', 215 | 'serif' 216 | ], 217 | mono: ['Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', 'monospace'] 218 | }, 219 | 220 | /* 221 | |----------------------------------------------------------------------------- 222 | | Text sizes https://tailwindcss.com/docs/text-sizing 223 | |----------------------------------------------------------------------------- 224 | | 225 | | Here is where you define your text sizes. Name these in whatever way 226 | | makes the most sense to you. We use size names by default, but 227 | | you're welcome to use a numeric scale or even something else 228 | | entirely. 229 | | 230 | | By default Tailwind uses the "rem" unit type for most measurements. 231 | | This allows you to set a root font size which all other sizes are 232 | | then based on. That said, you are free to use whatever units you 233 | | prefer, be it rems, ems, pixels or other. 234 | | 235 | | Class name: .text-{size} 236 | | 237 | */ 238 | 239 | textSizes: { 240 | xs: '.75rem', // 12px 241 | sm: '.875rem', // 14px 242 | base: '1rem', // 16px 243 | lg: '1.125rem', // 18px 244 | xl: '1.25rem', // 20px 245 | '2xl': '1.5rem', // 24px 246 | '3xl': '1.875rem', // 30px 247 | '4xl': '2.25rem', // 36px 248 | '5xl': '3rem' // 48px 249 | }, 250 | 251 | /* 252 | |----------------------------------------------------------------------------- 253 | | Font weights https://tailwindcss.com/docs/font-weight 254 | |----------------------------------------------------------------------------- 255 | | 256 | | Here is where you define your font weights. We've provided a list of 257 | | common font weight names with their respective numeric scale values 258 | | to get you started. It's unlikely that your project will require 259 | | all of these, so we recommend removing those you don't need. 260 | | 261 | | Class name: .font-{weight} 262 | | 263 | */ 264 | 265 | fontWeights: { 266 | hairline: 100, 267 | thin: 200, 268 | light: 300, 269 | normal: 400, 270 | medium: 500, 271 | semibold: 600, 272 | bold: 700, 273 | extrabold: 800, 274 | black: 900 275 | }, 276 | 277 | /* 278 | |----------------------------------------------------------------------------- 279 | | Leading (line height) https://tailwindcss.com/docs/line-height 280 | |----------------------------------------------------------------------------- 281 | | 282 | | Here is where you define your line height values, or as we call 283 | | them in Tailwind, leadings. 284 | | 285 | | Class name: .leading-{size} 286 | | 287 | */ 288 | 289 | leading: { 290 | none: 1, 291 | tight: 1.25, 292 | normal: 1.5, 293 | loose: 2 294 | }, 295 | 296 | /* 297 | |----------------------------------------------------------------------------- 298 | | Tracking (letter spacing) https://tailwindcss.com/docs/letter-spacing 299 | |----------------------------------------------------------------------------- 300 | | 301 | | Here is where you define your letter spacing values, or as we call 302 | | them in Tailwind, tracking. 303 | | 304 | | Class name: .tracking-{size} 305 | | 306 | */ 307 | 308 | tracking: { 309 | tight: '-0.05em', 310 | normal: '0', 311 | wide: '0.05em' 312 | }, 313 | 314 | /* 315 | |----------------------------------------------------------------------------- 316 | | Text colors https://tailwindcss.com/docs/text-color 317 | |----------------------------------------------------------------------------- 318 | | 319 | | Here is where you define your text colors. By default these use the 320 | | color palette we defined above, however you're welcome to set these 321 | | independently if that makes sense for your project. 322 | | 323 | | Class name: .text-{color} 324 | | 325 | */ 326 | 327 | textColors: colors, 328 | 329 | /* 330 | |----------------------------------------------------------------------------- 331 | | Background colors https://tailwindcss.com/docs/background-color 332 | |----------------------------------------------------------------------------- 333 | | 334 | | Here is where you define your background colors. By default these use 335 | | the color palette we defined above, however you're welcome to set 336 | | these independently if that makes sense for your project. 337 | | 338 | | Class name: .bg-{color} 339 | | 340 | */ 341 | 342 | backgroundColors: colors, 343 | 344 | /* 345 | |----------------------------------------------------------------------------- 346 | | Background sizes https://tailwindcss.com/docs/background-size 347 | |----------------------------------------------------------------------------- 348 | | 349 | | Here is where you define your background sizes. We provide some common 350 | | values that are useful in most projects, but feel free to add other sizes 351 | | that are specific to your project here as well. 352 | | 353 | | Class name: .bg-{size} 354 | | 355 | */ 356 | 357 | backgroundSize: { 358 | auto: 'auto', 359 | cover: 'cover', 360 | contain: 'contain' 361 | }, 362 | 363 | /* 364 | |----------------------------------------------------------------------------- 365 | | Border widths https://tailwindcss.com/docs/border-width 366 | |----------------------------------------------------------------------------- 367 | | 368 | | Here is where you define your border widths. Take note that border 369 | | widths require a special "default" value set as well. This is the 370 | | width that will be used when you do not specify a border width. 371 | | 372 | | Class name: .border{-side?}{-width?} 373 | | 374 | */ 375 | 376 | borderWidths: { 377 | default: '1px', 378 | '0': '0', 379 | '2': '2px', 380 | '4': '4px', 381 | '8': '8px' 382 | }, 383 | 384 | /* 385 | |----------------------------------------------------------------------------- 386 | | Border colors https://tailwindcss.com/docs/border-color 387 | |----------------------------------------------------------------------------- 388 | | 389 | | Here is where you define your border colors. By default these use the 390 | | color palette we defined above, however you're welcome to set these 391 | | independently if that makes sense for your project. 392 | | 393 | | Take note that border colors require a special "default" value set 394 | | as well. This is the color that will be used when you do not 395 | | specify a border color. 396 | | 397 | | Class name: .border-{color} 398 | | 399 | */ 400 | 401 | borderColors: global.Object.assign({ default: colors['grey-light'] }, colors), 402 | 403 | /* 404 | |----------------------------------------------------------------------------- 405 | | Border radius https://tailwindcss.com/docs/border-radius 406 | |----------------------------------------------------------------------------- 407 | | 408 | | Here is where you define your border radius values. If a `default` radius 409 | | is provided, it will be made available as the non-suffixed `.rounded` 410 | | utility. 411 | | 412 | | If your scale includes a `0` value to reset already rounded corners, it's 413 | | a good idea to put it first so other values are able to override it. 414 | | 415 | | Class name: .rounded{-side?}{-size?} 416 | | 417 | */ 418 | 419 | borderRadius: { 420 | none: '0', 421 | sm: '.125rem', 422 | default: '.25rem', 423 | lg: '.5rem', 424 | full: '9999px' 425 | }, 426 | 427 | /* 428 | |----------------------------------------------------------------------------- 429 | | Width https://tailwindcss.com/docs/width 430 | |----------------------------------------------------------------------------- 431 | | 432 | | Here is where you define your width utility sizes. These can be 433 | | percentage based, pixels, rems, or any other units. By default 434 | | we provide a sensible rem based numeric scale, a percentage 435 | | based fraction scale, plus some other common use-cases. You 436 | | can, of course, modify these values as needed. 437 | | 438 | | 439 | | It's also worth mentioning that Tailwind automatically escapes 440 | | invalid CSS class name characters, which allows you to have 441 | | awesome classes like .w-2/3. 442 | | 443 | | Class name: .w-{size} 444 | | 445 | */ 446 | 447 | width: { 448 | auto: 'auto', 449 | px: '1px', 450 | '1': '0.25rem', 451 | '2': '0.5rem', 452 | '3': '0.75rem', 453 | '4': '1rem', 454 | '5': '1.25rem', 455 | '6': '1.5rem', 456 | '8': '2rem', 457 | '10': '2.5rem', 458 | '12': '3rem', 459 | '16': '4rem', 460 | '24': '6rem', 461 | '32': '8rem', 462 | '48': '12rem', 463 | '64': '16rem', 464 | '1/2': '50%', 465 | '1/3': '33.33333%', 466 | '2/3': '66.66667%', 467 | '1/4': '25%', 468 | '3/4': '75%', 469 | '1/5': '20%', 470 | '2/5': '40%', 471 | '3/5': '60%', 472 | '4/5': '80%', 473 | '1/6': '16.66667%', 474 | '5/6': '83.33333%', 475 | full: '100%', 476 | screen: '100vw' 477 | }, 478 | 479 | /* 480 | |----------------------------------------------------------------------------- 481 | | Height https://tailwindcss.com/docs/height 482 | |----------------------------------------------------------------------------- 483 | | 484 | | Here is where you define your height utility sizes. These can be 485 | | percentage based, pixels, rems, or any other units. By default 486 | | we provide a sensible rem based numeric scale plus some other 487 | | common use-cases. You can, of course, modify these values as 488 | | needed. 489 | | 490 | | Class name: .h-{size} 491 | | 492 | */ 493 | 494 | height: { 495 | auto: 'auto', 496 | px: '1px', 497 | '1': '0.25rem', 498 | '2': '0.5rem', 499 | '3': '0.75rem', 500 | '4': '1rem', 501 | '5': '1.25rem', 502 | '6': '1.5rem', 503 | '8': '2rem', 504 | '10': '2.5rem', 505 | '12': '3rem', 506 | '16': '4rem', 507 | '24': '6rem', 508 | '32': '8rem', 509 | '48': '12rem', 510 | '64': '16rem', 511 | full: '100%', 512 | screen: '100vh' 513 | }, 514 | 515 | /* 516 | |----------------------------------------------------------------------------- 517 | | Minimum width https://tailwindcss.com/docs/min-width 518 | |----------------------------------------------------------------------------- 519 | | 520 | | Here is where you define your minimum width utility sizes. These can 521 | | be percentage based, pixels, rems, or any other units. We provide a 522 | | couple common use-cases by default. You can, of course, modify 523 | | these values as needed. 524 | | 525 | | Class name: .min-w-{size} 526 | | 527 | */ 528 | 529 | minWidth: { 530 | '0': '0', 531 | full: '100%' 532 | }, 533 | 534 | /* 535 | |----------------------------------------------------------------------------- 536 | | Minimum height https://tailwindcss.com/docs/min-height 537 | |----------------------------------------------------------------------------- 538 | | 539 | | Here is where you define your minimum height utility sizes. These can 540 | | be percentage based, pixels, rems, or any other units. We provide a 541 | | few common use-cases by default. You can, of course, modify these 542 | | values as needed. 543 | | 544 | | Class name: .min-h-{size} 545 | | 546 | */ 547 | 548 | minHeight: { 549 | '0': '0', 550 | full: '100%', 551 | screen: '100vh' 552 | }, 553 | 554 | /* 555 | |----------------------------------------------------------------------------- 556 | | Maximum width https://tailwindcss.com/docs/max-width 557 | |----------------------------------------------------------------------------- 558 | | 559 | | Here is where you define your maximum width utility sizes. These can 560 | | be percentage based, pixels, rems, or any other units. By default 561 | | we provide a sensible rem based scale and a "full width" size, 562 | | which is basically a reset utility. You can, of course, 563 | | modify these values as needed. 564 | | 565 | | Class name: .max-w-{size} 566 | | 567 | */ 568 | 569 | maxWidth: { 570 | xs: '20rem', 571 | sm: '30rem', 572 | md: '40rem', 573 | lg: '50rem', 574 | xl: '60rem', 575 | '2xl': '70rem', 576 | '3xl': '80rem', 577 | '4xl': '90rem', 578 | '5xl': '100rem', 579 | full: '100%' 580 | }, 581 | 582 | /* 583 | |----------------------------------------------------------------------------- 584 | | Maximum height https://tailwindcss.com/docs/max-height 585 | |----------------------------------------------------------------------------- 586 | | 587 | | Here is where you define your maximum height utility sizes. These can 588 | | be percentage based, pixels, rems, or any other units. We provide a 589 | | couple common use-cases by default. You can, of course, modify 590 | | these values as needed. 591 | | 592 | | Class name: .max-h-{size} 593 | | 594 | */ 595 | 596 | maxHeight: { 597 | full: '100%', 598 | screen: '100vh' 599 | }, 600 | 601 | /* 602 | |----------------------------------------------------------------------------- 603 | | Padding https://tailwindcss.com/docs/padding 604 | |----------------------------------------------------------------------------- 605 | | 606 | | Here is where you define your padding utility sizes. These can be 607 | | percentage based, pixels, rems, or any other units. By default we 608 | | provide a sensible rem based numeric scale plus a couple other 609 | | common use-cases like "1px". You can, of course, modify these 610 | | values as needed. 611 | | 612 | | Class name: .p{side?}-{size} 613 | | 614 | */ 615 | 616 | padding: { 617 | px: '1px', 618 | '0': '0', 619 | '1': '0.25rem', 620 | '2': '0.5rem', 621 | '3': '0.75rem', 622 | '4': '1rem', 623 | '5': '1.25rem', 624 | '6': '1.5rem', 625 | '8': '2rem', 626 | '10': '2.5rem', 627 | '12': '3rem', 628 | '16': '4rem', 629 | '20': '5rem', 630 | '24': '6rem', 631 | '32': '8rem' 632 | }, 633 | 634 | /* 635 | |----------------------------------------------------------------------------- 636 | | Margin https://tailwindcss.com/docs/margin 637 | |----------------------------------------------------------------------------- 638 | | 639 | | Here is where you define your margin utility sizes. These can be 640 | | percentage based, pixels, rems, or any other units. By default we 641 | | provide a sensible rem based numeric scale plus a couple other 642 | | common use-cases like "1px". You can, of course, modify these 643 | | values as needed. 644 | | 645 | | Class name: .m{side?}-{size} 646 | | 647 | */ 648 | 649 | margin: { 650 | auto: 'auto', 651 | px: '1px', 652 | '0': '0', 653 | '1': '0.25rem', 654 | '2': '0.5rem', 655 | '3': '0.75rem', 656 | '4': '1rem', 657 | '5': '1.25rem', 658 | '6': '1.5rem', 659 | '8': '2rem', 660 | '10': '2.5rem', 661 | '12': '3rem', 662 | '16': '4rem', 663 | '20': '5rem', 664 | '24': '6rem', 665 | '32': '8rem' 666 | }, 667 | 668 | /* 669 | |----------------------------------------------------------------------------- 670 | | Negative margin https://tailwindcss.com/docs/negative-margin 671 | |----------------------------------------------------------------------------- 672 | | 673 | | Here is where you define your negative margin utility sizes. These can 674 | | be percentage based, pixels, rems, or any other units. By default we 675 | | provide matching values to the padding scale since these utilities 676 | | generally get used together. You can, of course, modify these 677 | | values as needed. 678 | | 679 | | Class name: .-m{side?}-{size} 680 | | 681 | */ 682 | 683 | negativeMargin: { 684 | px: '1px', 685 | '0': '0', 686 | '1': '0.25rem', 687 | '2': '0.5rem', 688 | '3': '0.75rem', 689 | '4': '1rem', 690 | '5': '1.25rem', 691 | '6': '1.5rem', 692 | '8': '2rem', 693 | '10': '2.5rem', 694 | '12': '3rem', 695 | '16': '4rem', 696 | '20': '5rem', 697 | '24': '6rem', 698 | '32': '8rem' 699 | }, 700 | 701 | /* 702 | |----------------------------------------------------------------------------- 703 | | Shadows https://tailwindcss.com/docs/shadows 704 | |----------------------------------------------------------------------------- 705 | | 706 | | Here is where you define your shadow utilities. As you can see from 707 | | the defaults we provide, it's possible to apply multiple shadows 708 | | per utility using comma separation. 709 | | 710 | | If a `default` shadow is provided, it will be made available as the non- 711 | | suffixed `.shadow` utility. 712 | | 713 | | Class name: .shadow-{size?} 714 | | 715 | */ 716 | 717 | shadows: { 718 | default: '0 2px 4px 0 rgba(0,0,0,0.10)', 719 | md: '0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08)', 720 | lg: '0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)', 721 | inner: 'inset 0 2px 4px 0 rgba(0,0,0,0.06)', 722 | outline: '0 0 0 3px rgba(52,144,220,0.5)', 723 | none: 'none' 724 | }, 725 | 726 | /* 727 | |----------------------------------------------------------------------------- 728 | | Z-index https://tailwindcss.com/docs/z-index 729 | |----------------------------------------------------------------------------- 730 | | 731 | | Here is where you define your z-index utility values. By default we 732 | | provide a sensible numeric scale. You can, of course, modify these 733 | | values as needed. 734 | | 735 | | Class name: .z-{index} 736 | | 737 | */ 738 | 739 | zIndex: { 740 | auto: 'auto', 741 | '0': 0, 742 | '10': 10, 743 | '20': 20, 744 | '30': 30, 745 | '40': 40, 746 | '50': 50 747 | }, 748 | 749 | /* 750 | |----------------------------------------------------------------------------- 751 | | Opacity https://tailwindcss.com/docs/opacity 752 | |----------------------------------------------------------------------------- 753 | | 754 | | Here is where you define your opacity utility values. By default we 755 | | provide a sensible numeric scale. You can, of course, modify these 756 | | values as needed. 757 | | 758 | | Class name: .opacity-{name} 759 | | 760 | */ 761 | 762 | opacity: { 763 | '0': '0', 764 | '25': '.25', 765 | '50': '.5', 766 | '75': '.75', 767 | '100': '1' 768 | }, 769 | 770 | /* 771 | |----------------------------------------------------------------------------- 772 | | SVG fill https://tailwindcss.com/docs/svg 773 | |----------------------------------------------------------------------------- 774 | | 775 | | Here is where you define your SVG fill colors. By default we just provide 776 | | `fill-current` which sets the fill to the current text color. This lets you 777 | | specify a fill color using existing text color utilities and helps keep the 778 | | generated CSS file size down. 779 | | 780 | | Class name: .fill-{name} 781 | | 782 | */ 783 | 784 | svgFill: { 785 | current: 'currentColor' 786 | }, 787 | 788 | /* 789 | |----------------------------------------------------------------------------- 790 | | SVG stroke https://tailwindcss.com/docs/svg 791 | |----------------------------------------------------------------------------- 792 | | 793 | | Here is where you define your SVG stroke colors. By default we just provide 794 | | `stroke-current` which sets the stroke to the current text color. This lets 795 | | you specify a stroke color using existing text color utilities and helps 796 | | keep the generated CSS file size down. 797 | | 798 | | Class name: .stroke-{name} 799 | | 800 | */ 801 | 802 | svgStroke: { 803 | current: 'currentColor' 804 | }, 805 | 806 | /* 807 | |----------------------------------------------------------------------------- 808 | | Modules https://tailwindcss.com/docs/configuration#modules 809 | |----------------------------------------------------------------------------- 810 | | 811 | | Here is where you control which modules are generated and what variants are 812 | | generated for each of those modules. 813 | | 814 | | Currently supported variants: 815 | | - responsive 816 | | - hover 817 | | - focus 818 | | - active 819 | | - group-hover 820 | | 821 | | To disable a module completely, use `false` instead of an array. 822 | | 823 | */ 824 | 825 | modules: { 826 | appearance: ['responsive'], 827 | backgroundAttachment: ['responsive'], 828 | backgroundColors: ['responsive', 'hover', 'focus'], 829 | backgroundPosition: ['responsive'], 830 | backgroundRepeat: ['responsive'], 831 | backgroundSize: ['responsive'], 832 | borderCollapse: [], 833 | borderColors: ['responsive', 'hover', 'focus'], 834 | borderRadius: ['responsive'], 835 | borderStyle: ['responsive'], 836 | borderWidths: ['responsive'], 837 | cursor: ['responsive'], 838 | display: ['responsive'], 839 | flexbox: ['responsive'], 840 | float: ['responsive'], 841 | fonts: ['responsive'], 842 | fontWeights: ['responsive', 'hover', 'focus'], 843 | height: ['responsive'], 844 | leading: ['responsive'], 845 | lists: ['responsive'], 846 | margin: ['responsive'], 847 | maxHeight: ['responsive'], 848 | maxWidth: ['responsive'], 849 | minHeight: ['responsive'], 850 | minWidth: ['responsive'], 851 | negativeMargin: ['responsive'], 852 | opacity: ['responsive'], 853 | outline: ['focus'], 854 | overflow: ['responsive'], 855 | padding: ['responsive'], 856 | pointerEvents: ['responsive'], 857 | position: ['responsive'], 858 | resize: ['responsive'], 859 | shadows: ['responsive', 'hover', 'focus'], 860 | svgFill: [], 861 | svgStroke: [], 862 | tableLayout: ['responsive'], 863 | textAlign: ['responsive'], 864 | textColors: ['responsive', 'hover', 'focus'], 865 | textSizes: ['responsive'], 866 | textStyle: ['responsive', 'hover', 'focus'], 867 | tracking: ['responsive'], 868 | userSelect: ['responsive'], 869 | verticalAlign: ['responsive'], 870 | visibility: ['responsive'], 871 | whitespace: ['responsive'], 872 | width: ['responsive'], 873 | zIndex: ['responsive'] 874 | }, 875 | 876 | /* 877 | |----------------------------------------------------------------------------- 878 | | Plugins https://tailwindcss.com/docs/plugins 879 | |----------------------------------------------------------------------------- 880 | | 881 | | Here is where you can register any plugins you'd like to use in your 882 | | project. Tailwind's built-in `container` plugin is enabled by default to 883 | | give you a Bootstrap-style responsive container component out of the box. 884 | | 885 | | Be sure to view the complete plugin documentation to learn more about how 886 | | the plugin system works. 887 | | 888 | */ 889 | 890 | plugins: [ 891 | require('tailwindcss/plugins/container')({ 892 | // center: true, 893 | // padding: '1rem', 894 | }) 895 | ], 896 | 897 | /* 898 | |----------------------------------------------------------------------------- 899 | | Advanced Options https://tailwindcss.com/docs/configuration#options 900 | |----------------------------------------------------------------------------- 901 | | 902 | | Here is where you can tweak advanced configuration options. We recommend 903 | | leaving these options alone unless you absolutely need to change them. 904 | | 905 | */ 906 | 907 | options: { 908 | prefix: '', 909 | important: false, 910 | separator: ':' 911 | }, 912 | 913 | experiments: { 914 | shadowLookup: true 915 | } 916 | } 917 | -------------------------------------------------------------------------------- /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 | 'application/json']; 13 | 14 | protected function login(User $user = null) 15 | { 16 | $user = $user ? : create('App\Models\User'); 17 | $token = auth()->login($user); 18 | // JWTAuth::setToken($token); 19 | $this->headers['Authorization'] = 'Bearer ' . $token; 20 | 21 | return $this; 22 | } 23 | 24 | public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) 25 | { 26 | $applicationJson = $this->transformHeadersToServerVars($this->headers); 27 | $server = array_merge($server, $applicationJson); 28 | 29 | return parent::call($method, $uri, $parameters, $cookies, $files, $server, $content); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Unit/UserTest.php: -------------------------------------------------------------------------------- 1 | user = create('App\Models\User'); 19 | } 20 | 21 | /** @test */ 22 | public function it_can_confirm_a_user() 23 | { 24 | $this->assertFalse($this->user->confirmed); 25 | $this->assertNotNull($this->user->confirmation_token); 26 | 27 | $this->user->confirm(); 28 | 29 | $this->assertTrue($this->user->confirmed); 30 | $this->assertNull($this->user->confirmation_token); 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /tests/Utilities/functions.php: -------------------------------------------------------------------------------- 1 | create($attributes); 6 | } 7 | 8 | function make($class, $attributes = [], $times = null) 9 | { 10 | return factory($class, $times)->make($attributes); 11 | } 12 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | let mix = require('laravel-mix') 2 | let tailwindcss = require('tailwindcss') 3 | let fs = require('fs') 4 | let webpack = require('webpack') 5 | let purgeCss = require('laravel-mix-purgecss') 6 | 7 | mix.webpackConfig({ 8 | resolve: { 9 | alias: { 10 | '@': path.resolve(__dirname, 'resources/assets/js') 11 | } 12 | } 13 | }) 14 | 15 | mix 16 | .js('resources/assets/js/app.js', 'public/js') 17 | .sass('resources/assets/styles/app.scss', 'public/css/app.css') 18 | .options({ 19 | extractVueStyles: true, 20 | processCssUrls: false, 21 | postCss: [tailwindcss('tailwind.config.js')] 22 | }) 23 | .purgeCss() 24 | 25 | if (mix.inProduction()) { 26 | mix.version() 27 | } 28 | --------------------------------------------------------------------------------