├── .babelrc
├── .editorconfig
├── .env.dusk
├── .env.example
├── .eslintrc.js
├── .gitattributes
├── .github
└── workflows
│ └── tests.yml
├── .gitignore
├── .styleci.yml
├── LICENSE
├── app
├── Console
│ └── Kernel.php
├── Exceptions
│ ├── EmailTakenException.php
│ ├── Handler.php
│ └── VerifyEmailException.php
├── Http
│ ├── Controllers
│ │ ├── Auth
│ │ │ ├── ForgotPasswordController.php
│ │ │ ├── LoginController.php
│ │ │ ├── OAuthController.php
│ │ │ ├── RegisterController.php
│ │ │ ├── ResetPasswordController.php
│ │ │ ├── UserController.php
│ │ │ └── VerificationController.php
│ │ ├── Controller.php
│ │ ├── Settings
│ │ │ ├── PasswordController.php
│ │ │ └── ProfileController.php
│ │ └── SpaController.php
│ ├── Kernel.php
│ └── Middleware
│ │ ├── Authenticate.php
│ │ ├── EncryptCookies.php
│ │ ├── PreventRequestsDuringMaintenance.php
│ │ ├── RedirectIfAuthenticated.php
│ │ ├── SetLocale.php
│ │ ├── TrimStrings.php
│ │ ├── TrustHosts.php
│ │ ├── TrustProxies.php
│ │ └── VerifyCsrfToken.php
├── Models
│ ├── OAuthProvider.php
│ └── User.php
├── Notifications
│ ├── ResetPassword.php
│ └── VerifyEmail.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
├── cors.php
├── database.php
├── filesystems.php
├── hashing.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
│ ├── 2017_12_07_122845_create_oauth_providers_table.php
│ └── 2019_08_19_000000_create_failed_jobs_table.php
└── seeders
│ └── DatabaseSeeder.php
├── package-lock.json
├── package.json
├── phpunit.xml
├── public
├── .htaccess
├── favicon.ico
├── index.php
├── robots.txt
└── web.config
├── resources
├── js
│ ├── app.js
│ ├── components
│ │ ├── App.vue
│ │ ├── Child.vue
│ │ ├── Loading.vue
│ │ ├── LocaleDropdown.vue
│ │ ├── LoginWithGithub.vue
│ │ ├── Navbar.vue
│ │ ├── common
│ │ │ ├── Button.vue
│ │ │ ├── Card.vue
│ │ │ ├── Dropdown.vue
│ │ │ └── index.js
│ │ ├── forms
│ │ │ ├── Checkbox.vue
│ │ │ ├── TextInput.vue
│ │ │ ├── index.js
│ │ │ └── validation
│ │ │ │ ├── Alert.js
│ │ │ │ ├── AlertError.vue
│ │ │ │ ├── AlertSuccess.vue
│ │ │ │ └── HasError.vue
│ │ └── index.js
│ ├── lang
│ │ ├── en.json
│ │ ├── es.json
│ │ ├── fr.json
│ │ ├── pt-BR.json
│ │ └── zh-CN.json
│ ├── layouts
│ │ ├── basic.vue
│ │ └── default.vue
│ ├── middleware
│ │ ├── admin.js
│ │ ├── auth.js
│ │ ├── check-auth.js
│ │ ├── guest.js
│ │ ├── locale.js
│ │ └── role.js
│ ├── pages
│ │ ├── auth
│ │ │ ├── login.vue
│ │ │ ├── password
│ │ │ │ ├── email.vue
│ │ │ │ └── reset.vue
│ │ │ ├── register.vue
│ │ │ └── verification
│ │ │ │ ├── resend.vue
│ │ │ │ └── verify.vue
│ │ ├── errors
│ │ │ └── 404.vue
│ │ ├── home.vue
│ │ ├── settings
│ │ │ ├── index.vue
│ │ │ ├── password.vue
│ │ │ └── profile.vue
│ │ └── welcome.vue
│ ├── plugins
│ │ ├── axios.js
│ │ ├── i18n.js
│ │ └── index.js
│ ├── router
│ │ ├── index.js
│ │ └── routes.js
│ └── store
│ │ ├── index.js
│ │ ├── modules
│ │ ├── auth.js
│ │ └── lang.js
│ │ └── mutation-types.js
├── lang
│ ├── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ ├── validation.php
│ │ └── verification.php
│ ├── es
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
│ ├── pt-BR
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
│ └── zh-CN
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
├── sass
│ ├── app.scss
│ └── elements
│ │ ├── _buttons.scss
│ │ ├── _card.scss
│ │ ├── _navbar.scss
│ │ └── _transitions.scss
└── views
│ ├── errors
│ └── layout.blade.php
│ ├── oauth
│ ├── callback.blade.php
│ └── emailTaken.blade.php
│ └── spa.blade.php
├── routes
├── api.php
├── channels.php
├── console.php
├── spa.php
└── web.php
├── server.php
├── storage
├── app
│ ├── .gitignore
│ └── public
│ │ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ ├── .gitignore
│ │ └── data
│ │ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ ├── testing
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
├── tailwind.config.js
├── tests
├── Browser
│ ├── LoginTest.php
│ ├── Pages
│ │ ├── Home.php
│ │ ├── Login.php
│ │ ├── Page.php
│ │ └── Register.php
│ ├── RegisterTest.php
│ ├── WelcomeTest.php
│ ├── console
│ │ └── .gitignore
│ └── screenshots
│ │ └── .gitignore
├── CreatesApplication.php
├── DuskTestCase.php
├── Feature
│ ├── LocaleTest.php
│ ├── LoginTest.php
│ ├── OAuthTest.php
│ ├── RegisterTest.php
│ ├── SettingsTest.php
│ └── VerificationTest.php
├── TestCase.php
└── Unit
│ └── ExampleTest.php
└── webpack.mix.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-env"
4 | ],
5 | "plugins": [
6 | "@babel/plugin-syntax-dynamic-import"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | insert_final_newline = true
7 | indent_style = space
8 | indent_size = 4
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
14 | [*.{vue,js,json,html,scss,blade.php,yml}]
15 | indent_size = 2
16 |
--------------------------------------------------------------------------------
/.env.dusk:
--------------------------------------------------------------------------------
1 | APP_NAME="Laravel Vue Spa"
2 | APP_ENV=testing
3 | APP_KEY=base64:ZDLf88XPAUgLJv7l6c8IxGpKXxZGobomG994vKY03qk=
4 | APP_DEBUG=true
5 | APP_LOG_LEVEL=debug
6 | APP_URL=http://127.0.0.1:8000
7 |
8 | LOG_CHANNEL=stack
9 | LOG_LEVEL=debug
10 |
11 | DB_CONNECTION=dusk
12 |
13 | BROADCAST_DRIVER=log
14 | CACHE_DRIVER=file
15 | QUEUE_CONNECTION=sync
16 | SESSION_DRIVER=file
17 | SESSION_LIFETIME=120
18 |
19 | REDIS_HOST=127.0.0.1
20 | REDIS_PASSWORD=null
21 | REDIS_PORT=6379
22 |
23 | MAIL_MAILER=smtp
24 | MAIL_HOST=smtp.mailtrap.io
25 | MAIL_PORT=2525
26 | MAIL_USERNAME=null
27 | MAIL_PASSWORD=null
28 | MAIL_ENCRYPTION=null
29 | MAIL_FROM_ADDRESS=null
30 | MAIL_FROM_NAME="${APP_NAME}"
31 |
32 | AWS_ACCESS_KEY_ID=
33 | AWS_SECRET_ACCESS_KEY=
34 | AWS_DEFAULT_REGION=us-east-1
35 | AWS_BUCKET=
36 |
37 | PUSHER_APP_ID=
38 | PUSHER_APP_KEY=
39 | PUSHER_APP_SECRET=
40 | PUSHER_APP_CLUSTER=mt1
41 |
42 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
43 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
44 |
45 | JWT_TTL=1440
46 | JWT_SECRET=eJkecpCqbVBJn7Wvnt5GXTjIRoYh1OjwvDQywVobjwKbmGmwt4UUqPo3y6IlnqAG
47 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | APP_NAME="Laravel Vue Tailwind Spa"
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_LOG_LEVEL=debug
6 | APP_URL=http://localhost
7 |
8 | LOG_CHANNEL=stack
9 | LOG_LEVEL=debug
10 |
11 | DB_CONNECTION=mysql
12 | DB_HOST=127.0.0.1
13 | DB_PORT=3306
14 | DB_DATABASE=laravel
15 | DB_USERNAME=root
16 | DB_PASSWORD=
17 |
18 | BROADCAST_DRIVER=log
19 | CACHE_DRIVER=file
20 | QUEUE_CONNECTION=sync
21 | SESSION_DRIVER=file
22 | SESSION_LIFETIME=120
23 |
24 | REDIS_HOST=127.0.0.1
25 | REDIS_PASSWORD=null
26 | REDIS_PORT=6379
27 |
28 | MAIL_MAILER=smtp
29 | MAIL_HOST=smtp.mailtrap.io
30 | MAIL_PORT=2525
31 | MAIL_USERNAME=null
32 | MAIL_PASSWORD=null
33 | MAIL_ENCRYPTION=null
34 | MAIL_FROM_ADDRESS=null
35 | MAIL_FROM_NAME="${APP_NAME}"
36 |
37 | AWS_ACCESS_KEY_ID=
38 | AWS_SECRET_ACCESS_KEY=
39 | AWS_DEFAULT_REGION=us-east-1
40 | AWS_BUCKET=
41 |
42 | PUSHER_APP_ID=
43 | PUSHER_APP_KEY=
44 | PUSHER_APP_SECRET=
45 | PUSHER_APP_CLUSTER=mt1
46 |
47 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
48 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
49 |
50 | JWT_TTL=1440
51 | JWT_SECRET=
52 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'vue-eslint-parser',
4 | parserOptions: {
5 | parser: '@babel/eslint-parser',
6 | ecmaVersion: 2018,
7 | sourceType: 'module'
8 | },
9 | extends: [
10 | 'plugin:vue/recommended',
11 | 'standard'
12 | ],
13 | rules: {
14 | 'vue/max-attributes-per-line': 'off'
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 | *.js linguist-vendored
5 | CHANGELOG.md export-ignore
6 | README.md export-ignore
7 | .travis.yml export-ignore
8 | .env.dusk.local export-ignore
9 | .env.dusk.testing export-ignore
10 |
--------------------------------------------------------------------------------
/.github/workflows/tests.yml:
--------------------------------------------------------------------------------
1 | name: tests
2 |
3 | on:
4 | push:
5 | pull_request:
6 |
7 | jobs:
8 | tests:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | strategy:
13 | fail-fast: true
14 | matrix:
15 | php: [7.3, 7.4, 8.0]
16 |
17 | name: PHP ${{ matrix.php }}
18 |
19 | steps:
20 | - name: Checkout code
21 | uses: actions/checkout@v2
22 |
23 | - name: Get Composer cache directory
24 | id: composer-cache
25 | run: |
26 | echo "::set-output name=dir::$(composer config cache-files-dir)"
27 |
28 | - uses: actions/cache@v2
29 | with:
30 | path: ${{ steps.composer-cache.outputs.dir }}
31 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
32 | restore-keys: |
33 | ${{ runner.os }}-composer-
34 |
35 | - uses: actions/cache@v2
36 | with:
37 | path: ~/.npm
38 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
39 | restore-keys: |
40 | ${{ runner.os }}-node-
41 |
42 | - name: Setup PHP
43 | uses: shivammathur/setup-php@v2
44 | with:
45 | php-version: ${{ matrix.php }}
46 | extensions: dom, curl, mbstring, pdo, sqlite, pdo_sqlite
47 | tools: composer:v2
48 | coverage: none
49 |
50 | - name: Prepare the environment
51 | run: cp .env.example .env
52 |
53 | - name: Install composer dependencies
54 | run: composer install --prefer-dist --no-interaction --no-progress --ignore-platform-reqs --optimize-autoloader
55 |
56 | - name: Directory permissions
57 | run: chmod -R 777 storage bootstrap/cache
58 |
59 | - name: Run tests (Unit and Feature)
60 | run: vendor/bin/phpunit
61 |
62 | - name: Install npm dependencies
63 | run: npm install --no-audit --no-progress --silent
64 |
65 | - name: Build client
66 | run: npm run production
67 |
68 | - name: Upgrade Chrome driver
69 | run: php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
70 |
71 | - name: Start Chrome driver
72 | run: ./vendor/laravel/dusk/bin/chromedriver-linux &
73 |
74 | - name: Create database
75 | run: touch database/dusk.sqlite
76 |
77 | - name: Run Laravel server
78 | run: php artisan serve &
79 |
80 | - name: Run Dusk tests
81 | env:
82 | APP_URL: "http://127.0.0.1:8000"
83 | run: php artisan dusk
84 |
85 | - name: Upload screenshots
86 | if: failure()
87 | uses: actions/upload-artifact@v2
88 | with:
89 | name: screenshots
90 | path: tests/Browser/screenshots
91 |
92 | - name: Upload console logs
93 | if: failure()
94 | uses: actions/upload-artifact@v2
95 | with:
96 | name: console
97 | path: tests/Browser/console
98 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /public/hot
3 | /public/storage
4 | /storage/*.key
5 | /vendor
6 | .env
7 | .env.backup
8 | .env.dusk.local
9 | .phpunit.result.cache
10 | .idea/*
11 | Homestead.json
12 | Homestead.yaml
13 | npm-debug.log
14 | yarn-error.log
15 | phpunit.dusk.xml
16 | /public/dist
17 | /public/build
18 | /public/mix-manifest.json
19 |
--------------------------------------------------------------------------------
/.styleci.yml:
--------------------------------------------------------------------------------
1 | php:
2 | preset: laravel
3 | disabled:
4 | - no_unused_imports
5 | finder:
6 | not-name:
7 | - index.php
8 | - server.php
9 | js:
10 | finder:
11 | not-name:
12 | - webpack.mix.js
13 | css: true
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Cretu Eusebiu
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 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')->hourly();
28 | }
29 |
30 | /**
31 | * Register the commands for the application.
32 | *
33 | * @return void
34 | */
35 | protected function commands()
36 | {
37 | $this->load(__DIR__.'/Commands');
38 |
39 | require base_path('routes/console.php');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/Exceptions/EmailTakenException.php:
--------------------------------------------------------------------------------
1 | view('oauth.emailTaken', [], 400);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | expectsJson()
39 | ? response()->json(['message' => $exception->getMessage()], 401)
40 | : redirect()->guest(url('/login'));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/Exceptions/VerifyEmailException.php:
--------------------------------------------------------------------------------
1 | [__('You must :linkOpen verify :linkClose your email first.', [
17 | 'linkOpen' => '',
18 | 'linkClose' => '',
19 | ])],
20 | ]);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/ForgotPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
21 | }
22 |
23 | /**
24 | * Get the response for a successful password reset link.
25 | *
26 | * @param \Illuminate\Http\Request $request
27 | * @param string $response
28 | * @return \Illuminate\Http\RedirectResponse
29 | */
30 | protected function sendResetLinkResponse(Request $request, $response)
31 | {
32 | return ['status' => trans($response)];
33 | }
34 |
35 | /**
36 | * Get the response for a failed password reset link.
37 | *
38 | * @param \Illuminate\Http\Request $request
39 | * @param string $response
40 | * @return \Illuminate\Http\RedirectResponse
41 | */
42 | protected function sendResetLinkFailedResponse(Request $request, $response)
43 | {
44 | return response()->json(['email' => trans($response)], 400);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/LoginController.php:
--------------------------------------------------------------------------------
1 | middleware('guest')->except('logout');
24 | }
25 |
26 | /**
27 | * Attempt to log the user into the application.
28 | *
29 | * @param \Illuminate\Http\Request $request
30 | * @return bool
31 | */
32 | protected function attemptLogin(Request $request)
33 | {
34 | $token = $this->guard()->attempt($this->credentials($request));
35 |
36 | if (! $token) {
37 | return false;
38 | }
39 |
40 | $user = $this->guard()->user();
41 | if ($user instanceof MustVerifyEmail && ! $user->hasVerifiedEmail()) {
42 | return false;
43 | }
44 |
45 | $this->guard()->setToken($token);
46 |
47 | return true;
48 | }
49 |
50 | /**
51 | * Send the response after the user was authenticated.
52 | *
53 | * @param \Illuminate\Http\Request $request
54 | * @return \Illuminate\Http\JsonResponse
55 | */
56 | protected function sendLoginResponse(Request $request)
57 | {
58 | $this->clearLoginAttempts($request);
59 |
60 | $token = (string) $this->guard()->getToken();
61 | $expiration = $this->guard()->getPayload()->get('exp');
62 |
63 | return response()->json([
64 | 'token' => $token,
65 | 'token_type' => 'bearer',
66 | 'expires_in' => $expiration - time(),
67 | ]);
68 | }
69 |
70 | /**
71 | * Get the failed login response instance.
72 | *
73 | * @param \Illuminate\Http\Request $request
74 | * @return \Illuminate\Http\JsonResponse
75 | *
76 | * @throws \Illuminate\Validation\ValidationException
77 | */
78 | protected function sendFailedLoginResponse(Request $request)
79 | {
80 | $user = $this->guard()->user();
81 | if ($user instanceof MustVerifyEmail && ! $user->hasVerifiedEmail()) {
82 | throw VerifyEmailException::forUser($user);
83 | }
84 |
85 | throw ValidationException::withMessages([
86 | $this->username() => [trans('auth.failed')],
87 | ]);
88 | }
89 |
90 | /**
91 | * Log the user out of the application.
92 | *
93 | * @param \Illuminate\Http\Request $request
94 | * @return \Illuminate\Http\Response
95 | */
96 | public function logout(Request $request)
97 | {
98 | $this->guard()->logout();
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/OAuthController.php:
--------------------------------------------------------------------------------
1 | route('oauth.callback', 'github'),
25 | ]);
26 | }
27 |
28 | /**
29 | * Redirect the user to the provider authentication page.
30 | *
31 | * @param string $provider
32 | * @return \Illuminate\Http\RedirectResponse
33 | */
34 | public function redirect($provider)
35 | {
36 | return [
37 | 'url' => Socialite::driver($provider)->stateless()->redirect()->getTargetUrl(),
38 | ];
39 | }
40 |
41 | /**
42 | * Obtain the user information from the provider.
43 | *
44 | * @param string $driver
45 | * @return \Illuminate\Http\Response
46 | */
47 | public function handleCallback($provider)
48 | {
49 | $user = Socialite::driver($provider)->stateless()->user();
50 | $user = $this->findOrCreateUser($provider, $user);
51 |
52 | $this->guard()->setToken(
53 | $token = $this->guard()->login($user)
54 | );
55 |
56 | return view('oauth/callback', [
57 | 'token' => $token,
58 | 'token_type' => 'bearer',
59 | 'expires_in' => $this->guard()->getPayload()->get('exp') - time(),
60 | ]);
61 | }
62 |
63 | /**
64 | * @param string $provider
65 | * @param \Laravel\Socialite\Contracts\User $sUser
66 | * @return \App\Models\User
67 | */
68 | protected function findOrCreateUser($provider, $user)
69 | {
70 | $oauthProvider = OAuthProvider::where('provider', $provider)
71 | ->where('provider_user_id', $user->getId())
72 | ->first();
73 |
74 | if ($oauthProvider) {
75 | $oauthProvider->update([
76 | 'access_token' => $user->token,
77 | 'refresh_token' => $user->refreshToken,
78 | ]);
79 |
80 | return $oauthProvider->user;
81 | }
82 |
83 | if (User::where('email', $user->getEmail())->exists()) {
84 | throw new EmailTakenException;
85 | }
86 |
87 | return $this->createUser($provider, $user);
88 | }
89 |
90 | /**
91 | * @param string $provider
92 | * @param \Laravel\Socialite\Contracts\User $sUser
93 | * @return \App\Models\User
94 | */
95 | protected function createUser($provider, $sUser)
96 | {
97 | $user = User::create([
98 | 'name' => $sUser->getName(),
99 | 'email' => $sUser->getEmail(),
100 | 'email_verified_at' => now(),
101 | ]);
102 |
103 | $user->oauthProviders()->create([
104 | 'provider' => $provider,
105 | 'provider_user_id' => $sUser->getId(),
106 | 'access_token' => $sUser->token,
107 | 'refresh_token' => $sUser->refreshToken,
108 | ]);
109 |
110 | return $user;
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/RegisterController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
24 | }
25 |
26 | /**
27 | * The user has been registered.
28 | *
29 | * @param \Illuminate\Http\Request $request
30 | * @param \App\User $user
31 | * @return \Illuminate\Http\JsonResponse
32 | */
33 | protected function registered(Request $request, User $user)
34 | {
35 | if ($user instanceof MustVerifyEmail) {
36 | return response()->json(['status' => trans('verification.sent')]);
37 | }
38 |
39 | return response()->json($user);
40 | }
41 |
42 | /**
43 | * Get a validator for an incoming registration request.
44 | *
45 | * @param array $data
46 | * @return \Illuminate\Contracts\Validation\Validator
47 | */
48 | protected function validator(array $data)
49 | {
50 | return Validator::make($data, [
51 | 'name' => 'required|max:255',
52 | 'email' => 'required|email:filter|max:255|unique:users',
53 | 'password' => 'required|min:6|confirmed',
54 | ]);
55 | }
56 |
57 | /**
58 | * Create a new user instance after a valid registration.
59 | *
60 | * @param array $data
61 | * @return \App\User
62 | */
63 | protected function create(array $data)
64 | {
65 | return User::create([
66 | 'name' => $data['name'],
67 | 'email' => $data['email'],
68 | 'password' => bcrypt($data['password']),
69 | ]);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/ResetPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
21 | }
22 |
23 | /**
24 | * Get the response for a successful password reset.
25 | *
26 | * @param \Illuminate\Http\Request $request
27 | * @param string $response
28 | * @return \Illuminate\Http\RedirectResponse
29 | */
30 | protected function sendResetResponse(Request $request, $response)
31 | {
32 | return ['status' => trans($response)];
33 | }
34 |
35 | /**
36 | * Get the response for a failed password reset.
37 | *
38 | * @param \Illuminate\Http\Request $request
39 | * @param string $response
40 | * @return \Illuminate\Http\RedirectResponse
41 | */
42 | protected function sendResetFailedResponse(Request $request, $response)
43 | {
44 | return response()->json(['email' => trans($response)], 400);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/UserController.php:
--------------------------------------------------------------------------------
1 | json($request->user());
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/VerificationController.php:
--------------------------------------------------------------------------------
1 | middleware('throttle:6,1')->only('verify', 'resend');
22 | }
23 |
24 | /**
25 | * Mark the user's email address as verified.
26 | *
27 | * @param \Illuminate\Http\Request $request
28 | * @param \App\User $user
29 | * @return \Illuminate\Http\JsonResponse
30 | */
31 | public function verify(Request $request, User $user)
32 | {
33 | if (! URL::hasValidSignature($request)) {
34 | return response()->json([
35 | 'status' => trans('verification.invalid'),
36 | ], 400);
37 | }
38 |
39 | if ($user->hasVerifiedEmail()) {
40 | return response()->json([
41 | 'status' => trans('verification.already_verified'),
42 | ], 400);
43 | }
44 |
45 | $user->markEmailAsVerified();
46 |
47 | event(new Verified($user));
48 |
49 | return response()->json([
50 | 'status' => trans('verification.verified'),
51 | ]);
52 | }
53 |
54 | /**
55 | * Resend the email verification notification.
56 | *
57 | * @param \Illuminate\Http\Request $request
58 | * @return \Illuminate\Http\JsonResponse
59 | */
60 | public function resend(Request $request)
61 | {
62 | $this->validate($request, ['email' => 'required|email']);
63 |
64 | $user = User::where('email', $request->email)->first();
65 |
66 | if (is_null($user)) {
67 | throw ValidationException::withMessages([
68 | 'email' => [trans('verification.user')],
69 | ]);
70 | }
71 |
72 | if ($user->hasVerifiedEmail()) {
73 | throw ValidationException::withMessages([
74 | 'email' => [trans('verification.already_verified')],
75 | ]);
76 | }
77 |
78 | $user->sendEmailVerificationNotification();
79 |
80 | return response()->json(['status' => trans('verification.sent')]);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | validate($request, [
19 | 'password' => 'required|confirmed|min:6',
20 | ]);
21 |
22 | $request->user()->update([
23 | 'password' => bcrypt($request->password),
24 | ]);
25 |
26 | return response()->json(null, 204);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Settings/ProfileController.php:
--------------------------------------------------------------------------------
1 | user();
19 |
20 | $this->validate($request, [
21 | 'name' => 'required',
22 | 'email' => 'required|email|unique:users,email,'.$user->id,
23 | ]);
24 |
25 | return tap($user)->update($request->only('name', 'email'));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/Http/Controllers/SpaController.php:
--------------------------------------------------------------------------------
1 | [
34 | \App\Http\Middleware\EncryptCookies::class,
35 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
36 | \Illuminate\Session\Middleware\StartSession::class,
37 | // \Illuminate\Session\Middleware\AuthenticateSession::class,
38 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
39 | \App\Http\Middleware\VerifyCsrfToken::class,
40 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
41 | ],
42 |
43 | 'spa' => [
44 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
45 | ],
46 |
47 | 'api' => [
48 | 'throttle:60,1',
49 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
50 | ],
51 | ];
52 |
53 | /**
54 | * The application's route middleware.
55 | *
56 | * These middleware may be assigned to groups or used individually.
57 | *
58 | * @var array
59 | */
60 | protected $routeMiddleware = [
61 | 'auth' => \App\Http\Middleware\Authenticate::class,
62 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
63 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
64 | 'can' => \Illuminate\Auth\Middleware\Authorize::class,
65 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
66 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
67 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
68 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
69 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
70 | ];
71 | }
72 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | expectsJson()) {
18 | return redirect('/login');
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
26 | if ($request->expectsJson()) {
27 | return response()->json(['error' => 'Already authenticated.'], 400);
28 | } else {
29 | return redirect(RouteServiceProvider::HOME);
30 | }
31 | }
32 | }
33 |
34 | return $next($request);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/Http/Middleware/SetLocale.php:
--------------------------------------------------------------------------------
1 | parseLocale($request)) {
19 | app()->setLocale($locale);
20 | }
21 |
22 | return $next($request);
23 | }
24 |
25 | /**
26 | * @param \Illuminate\Http\Request $request
27 | * @return string|null
28 | */
29 | protected function parseLocale($request)
30 | {
31 | $locales = config('app.locales');
32 |
33 | $locale = $request->server('HTTP_ACCEPT_LANGUAGE');
34 | $locale = substr($locale, 0, strpos($locale, ',') ?: strlen($locale));
35 |
36 | if (array_key_exists($locale, $locales)) {
37 | return $locale;
38 | }
39 |
40 | $locale = substr($locale, 0, 2);
41 | if (array_key_exists($locale, $locales)) {
42 | return $locale;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrimStrings.php:
--------------------------------------------------------------------------------
1 | allSubdomainsOfApplicationUrl(),
18 | ];
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrustProxies.php:
--------------------------------------------------------------------------------
1 | belongsTo(User::class);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/Models/User.php:
--------------------------------------------------------------------------------
1 | 'datetime',
46 | ];
47 |
48 | /**
49 | * The accessors to append to the model's array form.
50 | *
51 | * @var array
52 | */
53 | protected $appends = [
54 | 'photo_url',
55 | ];
56 |
57 | /**
58 | * Get the profile photo URL attribute.
59 | *
60 | * @return string
61 | */
62 | public function getPhotoUrlAttribute()
63 | {
64 | return vsprintf('https://www.gravatar.com/avatar/%s.jpg?s=200&d=%s', [
65 | md5(strtolower($this->email)),
66 | $this->name ? urlencode("https://ui-avatars.com/api/$this->name") : 'mp',
67 | ]);
68 | }
69 |
70 | /**
71 | * Get the oauth providers.
72 | *
73 | * @return \Illuminate\Database\Eloquent\Relations\HasMany
74 | */
75 | public function oauthProviders()
76 | {
77 | return $this->hasMany(OAuthProvider::class);
78 | }
79 |
80 | /**
81 | * Send the password reset notification.
82 | *
83 | * @param string $token
84 | * @return void
85 | */
86 | public function sendPasswordResetNotification($token)
87 | {
88 | $this->notify(new ResetPassword($token));
89 | }
90 |
91 | /**
92 | * Send the email verification notification.
93 | *
94 | * @return void
95 | */
96 | public function sendEmailVerificationNotification()
97 | {
98 | $this->notify(new VerifyEmail);
99 | }
100 |
101 | /**
102 | * @return int
103 | */
104 | public function getJWTIdentifier()
105 | {
106 | return $this->getKey();
107 | }
108 |
109 | /**
110 | * @return array
111 | */
112 | public function getJWTCustomClaims()
113 | {
114 | return [];
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/Notifications/ResetPassword.php:
--------------------------------------------------------------------------------
1 | line('You are receiving this email because we received a password reset request for your account.')
20 | ->action('Reset Password', url(config('app.url').'/password/reset/'.$this->token).'?email='.urlencode($notifiable->email))
21 | ->line('If you did not request a password reset, no further action is required.');
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/Notifications/VerifyEmail.php:
--------------------------------------------------------------------------------
1 | addMinutes(60), ['user' => $notifiable->id]
21 | );
22 |
23 | return str_replace('/api', '', $url);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | app->runningUnitTests()) {
19 | Schema::defaultStringLength(191);
20 | }
21 | }
22 |
23 | /**
24 | * Register any application services.
25 | *
26 | * @return void
27 | */
28 | public function register()
29 | {
30 | if ($this->app->environment('local', 'testing') && class_exists(DuskServiceProvider::class)) {
31 | $this->app->register(DuskServiceProvider::class);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
16 | ];
17 |
18 | /**
19 | * Register any authentication / authorization services.
20 | *
21 | * @return void
22 | */
23 | public function boot()
24 | {
25 | $this->registerPolicies();
26 |
27 | //
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/Providers/BroadcastServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
19 | SendEmailVerificationNotification::class,
20 | ],
21 | ];
22 |
23 | /**
24 | * Register any events for your application.
25 | *
26 | * @return void
27 | */
28 | public function boot()
29 | {
30 | //
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | configureRateLimiting();
39 |
40 | $this->routes(function () {
41 | Route::prefix('api')
42 | ->middleware('api')
43 | ->namespace($this->namespace)
44 | ->group(base_path('routes/api.php'));
45 |
46 | Route::middleware('web')
47 | ->namespace($this->namespace)
48 | ->group(base_path('routes/web.php'));
49 |
50 | Route::middleware('spa')
51 | ->namespace($this->namespace)
52 | ->group(base_path('routes/spa.php'));
53 | });
54 | }
55 |
56 | /**
57 | * Configure the rate limiters for the application.
58 | *
59 | * @return void
60 | */
61 | protected function configureRateLimiting()
62 | {
63 | RateLimiter::for('api', function (Request $request) {
64 | return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
65 | });
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/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": "jhumanj/laravel-vue-tailwind-spa",
3 | "description": "A Laravel-Vue-Tailwind SPA starter project template.",
4 | "keywords": ["spa", "laravel", "vue", "Tailwind"],
5 | "license": "MIT",
6 | "type": "project",
7 | "require": {
8 | "php": "^7.3|^8.0",
9 | "fideloper/proxy": "^4.4",
10 | "fruitcake/laravel-cors": "^2.0",
11 | "guzzlehttp/guzzle": "^7.0.1",
12 | "laravel/framework": "^8.34",
13 | "laravel/socialite": "^5.2",
14 | "laravel/tinker": "^2.6",
15 | "laravel/ui": "^3.2",
16 | "tymon/jwt-auth": "^1.0.2"
17 | },
18 | "require-dev": {
19 | "doctrine/dbal": "^2.12",
20 | "facade/ignition": "^2.5",
21 | "fakerphp/faker": "^1.9.1",
22 | "laravel/dusk": "^6.8",
23 | "mockery/mockery": "^1.4.2",
24 | "nunomaduro/collision": "^5.0",
25 | "phpunit/phpunit": "^9.3.3"
26 | },
27 | "config": {
28 | "optimize-autoloader": true,
29 | "preferred-install": "dist",
30 | "sort-packages": true
31 | },
32 | "extra": {
33 | "laravel": {
34 | "dont-discover": [
35 | "laravel/dusk"
36 | ]
37 | }
38 | },
39 | "autoload": {
40 | "psr-4": {
41 | "App\\": "app/",
42 | "Database\\Factories\\": "database/factories/",
43 | "Database\\Seeders\\": "database/seeders/"
44 | }
45 | },
46 | "autoload-dev": {
47 | "psr-4": {
48 | "Tests\\": "tests/"
49 | }
50 | },
51 | "minimum-stability": "dev",
52 | "prefer-stable": true,
53 | "scripts": {
54 | "post-autoload-dump": [
55 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
56 | "@php artisan package:discover --ansi"
57 | ],
58 | "post-root-package-install": [
59 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
60 | ],
61 | "post-create-project-cmd": [
62 | "@php artisan key:generate --ansi",
63 | "@php artisan jwt:secret --force --ansi"
64 | ]
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/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 | 'hash' => false,
48 | ],
49 | ],
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | User Providers
54 | |--------------------------------------------------------------------------
55 | |
56 | | All authentication drivers have a user provider. This defines how the
57 | | users are actually retrieved out of your database or other storage
58 | | mechanisms used by this application to persist your user's data.
59 | |
60 | | If you have multiple user tables or models you may configure multiple
61 | | sources which represent each model / table. These sources may then
62 | | be assigned to any extra authentication guards you have defined.
63 | |
64 | | Supported: "database", "eloquent"
65 | |
66 | */
67 |
68 | 'providers' => [
69 | 'users' => [
70 | 'driver' => 'eloquent',
71 | 'model' => App\Models\User::class,
72 | ],
73 |
74 | // 'users' => [
75 | // 'driver' => 'database',
76 | // 'table' => 'users',
77 | // ],
78 | ],
79 |
80 | /*
81 | |--------------------------------------------------------------------------
82 | | Resetting Passwords
83 | |--------------------------------------------------------------------------
84 | |
85 | | You may specify multiple password reset configurations if you have more
86 | | than one user table or model in the application and you want to have
87 | | separate password reset settings based on the specific user types.
88 | |
89 | | The expire time is the number of minutes that the reset token should be
90 | | considered valid. This security feature keeps tokens short-lived so
91 | | they have less time to be guessed. You may change this as needed.
92 | |
93 | */
94 |
95 | 'passwords' => [
96 | 'users' => [
97 | 'provider' => 'users',
98 | 'table' => 'password_resets',
99 | 'expire' => 60,
100 | 'throttle' => 60,
101 | ],
102 | ],
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Password Confirmation Timeout
107 | |--------------------------------------------------------------------------
108 | |
109 | | Here you may define the amount of seconds before a password confirmation
110 | | times out and the user is prompted to re-enter their password via the
111 | | confirmation screen. By default, the timeout lasts for three hours.
112 | |
113 | */
114 |
115 | 'password_timeout' => 10800,
116 |
117 | ];
118 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'null'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Broadcast Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may define all of the broadcast connections that will be used
26 | | to broadcast events to other systems or over websockets. Samples of
27 | | each available type of connection are provided inside this array.
28 | |
29 | */
30 |
31 | 'connections' => [
32 |
33 | 'pusher' => [
34 | 'driver' => 'pusher',
35 | 'key' => env('PUSHER_APP_KEY'),
36 | 'secret' => env('PUSHER_APP_SECRET'),
37 | 'app_id' => env('PUSHER_APP_ID'),
38 | 'options' => [
39 | 'cluster' => env('PUSHER_APP_CLUSTER'),
40 | 'useTLS' => true,
41 | ],
42 | ],
43 |
44 | 'redis' => [
45 | 'driver' => 'redis',
46 | 'connection' => 'default',
47 | ],
48 |
49 | 'log' => [
50 | 'driver' => 'log',
51 | ],
52 |
53 | 'null' => [
54 | 'driver' => 'null',
55 | ],
56 |
57 | ],
58 |
59 | ];
60 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Cache Stores
26 | |--------------------------------------------------------------------------
27 | |
28 | | Here you may define all of the cache "stores" for your application as
29 | | well as their drivers. You may even define multiple stores for the
30 | | same cache driver to group types of items stored in your caches.
31 | |
32 | */
33 |
34 | 'stores' => [
35 |
36 | 'apc' => [
37 | 'driver' => 'apc',
38 | ],
39 |
40 | 'array' => [
41 | 'driver' => 'array',
42 | 'serialize' => false,
43 | ],
44 |
45 | 'database' => [
46 | 'driver' => 'database',
47 | 'table' => 'cache',
48 | 'connection' => null,
49 | ],
50 |
51 | 'file' => [
52 | 'driver' => 'file',
53 | 'path' => storage_path('framework/cache/data'),
54 | ],
55 |
56 | 'memcached' => [
57 | 'driver' => 'memcached',
58 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
59 | 'sasl' => [
60 | env('MEMCACHED_USERNAME'),
61 | env('MEMCACHED_PASSWORD'),
62 | ],
63 | 'options' => [
64 | // Memcached::OPT_CONNECT_TIMEOUT => 2000,
65 | ],
66 | 'servers' => [
67 | [
68 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
69 | 'port' => env('MEMCACHED_PORT', 11211),
70 | 'weight' => 100,
71 | ],
72 | ],
73 | ],
74 |
75 | 'redis' => [
76 | 'driver' => 'redis',
77 | 'connection' => 'cache',
78 | ],
79 |
80 | 'dynamodb' => [
81 | 'driver' => 'dynamodb',
82 | 'key' => env('AWS_ACCESS_KEY_ID'),
83 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
84 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
85 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
86 | 'endpoint' => env('DYNAMODB_ENDPOINT'),
87 | ],
88 |
89 | ],
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Cache Key Prefix
94 | |--------------------------------------------------------------------------
95 | |
96 | | When utilizing a RAM based store such as APC or Memcached, there might
97 | | be other applications utilizing the same cache. So, we'll specify a
98 | | value to get prefixed to all our keys so we can avoid collisions.
99 | |
100 | */
101 |
102 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
103 |
104 | ];
105 |
--------------------------------------------------------------------------------
/config/cors.php:
--------------------------------------------------------------------------------
1 | ['api/*'],
19 |
20 | 'allowed_methods' => ['*'],
21 |
22 | 'allowed_origins' => ['*'],
23 |
24 | 'allowed_origins_patterns' => [],
25 |
26 | 'allowed_headers' => ['*'],
27 |
28 | 'exposed_headers' => [],
29 |
30 | 'max_age' => 0,
31 |
32 | 'supports_credentials' => false,
33 |
34 | ];
35 |
--------------------------------------------------------------------------------
/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"
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 | 'endpoint' => env('AWS_ENDPOINT'),
66 | ],
67 |
68 | ],
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Symbolic Links
73 | |--------------------------------------------------------------------------
74 | |
75 | | Here you may configure the symbolic links that will be created when the
76 | | `storage:link` Artisan command is executed. The array keys should be
77 | | the locations of the links and the values should be their targets.
78 | |
79 | */
80 |
81 | 'links' => [
82 | public_path('storage') => storage_path('app/public'),
83 | ],
84 |
85 | ];
86 |
--------------------------------------------------------------------------------
/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/logging.php:
--------------------------------------------------------------------------------
1 | env('LOG_CHANNEL', 'stack'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Log Channels
25 | |--------------------------------------------------------------------------
26 | |
27 | | Here you may configure the log channels for your application. Out of
28 | | the box, Laravel uses the Monolog PHP logging library. This gives
29 | | you a variety of powerful log handlers / formatters to utilize.
30 | |
31 | | Available Drivers: "single", "daily", "slack", "syslog",
32 | | "errorlog", "monolog",
33 | | "custom", "stack"
34 | |
35 | */
36 |
37 | 'channels' => [
38 | 'stack' => [
39 | 'driver' => 'stack',
40 | 'channels' => ['single'],
41 | 'ignore_exceptions' => false,
42 | ],
43 |
44 | 'single' => [
45 | 'driver' => 'single',
46 | 'path' => storage_path('logs/laravel.log'),
47 | 'level' => env('LOG_LEVEL', 'debug'),
48 | ],
49 |
50 | 'daily' => [
51 | 'driver' => 'daily',
52 | 'path' => storage_path('logs/laravel.log'),
53 | 'level' => env('LOG_LEVEL', 'debug'),
54 | 'days' => 14,
55 | ],
56 |
57 | 'slack' => [
58 | 'driver' => 'slack',
59 | 'url' => env('LOG_SLACK_WEBHOOK_URL'),
60 | 'username' => 'Laravel Log',
61 | 'emoji' => ':boom:',
62 | 'level' => env('LOG_LEVEL', 'critical'),
63 | ],
64 |
65 | 'papertrail' => [
66 | 'driver' => 'monolog',
67 | 'level' => env('LOG_LEVEL', 'debug'),
68 | 'handler' => SyslogUdpHandler::class,
69 | 'handler_with' => [
70 | 'host' => env('PAPERTRAIL_URL'),
71 | 'port' => env('PAPERTRAIL_PORT'),
72 | ],
73 | ],
74 |
75 | 'stderr' => [
76 | 'driver' => 'monolog',
77 | 'handler' => StreamHandler::class,
78 | 'formatter' => env('LOG_STDERR_FORMATTER'),
79 | 'with' => [
80 | 'stream' => 'php://stderr',
81 | ],
82 | ],
83 |
84 | 'syslog' => [
85 | 'driver' => 'syslog',
86 | 'level' => env('LOG_LEVEL', 'debug'),
87 | ],
88 |
89 | 'errorlog' => [
90 | 'driver' => 'errorlog',
91 | 'level' => env('LOG_LEVEL', 'debug'),
92 | ],
93 |
94 | 'null' => [
95 | 'driver' => 'monolog',
96 | 'handler' => NullHandler::class,
97 | ],
98 |
99 | 'emergency' => [
100 | 'path' => storage_path('logs/laravel.log'),
101 | ],
102 | ],
103 |
104 | ];
105 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_MAILER', 'smtp'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Mailer Configurations
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure all of the mailers used by your application plus
24 | | their respective settings. Several examples have been configured for
25 | | you and you are free to add your own as your application requires.
26 | |
27 | | Laravel supports a variety of mail "transport" drivers to be used while
28 | | sending an e-mail. You will specify which one you are using for your
29 | | mailers below. You are free to add additional mailers as required.
30 | |
31 | | Supported: "smtp", "sendmail", "mailgun", "ses",
32 | | "postmark", "log", "array"
33 | |
34 | */
35 |
36 | 'mailers' => [
37 | 'smtp' => [
38 | 'transport' => 'smtp',
39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
40 | 'port' => env('MAIL_PORT', 587),
41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
42 | 'username' => env('MAIL_USERNAME'),
43 | 'password' => env('MAIL_PASSWORD'),
44 | 'timeout' => null,
45 | 'auth_mode' => null,
46 | ],
47 |
48 | 'ses' => [
49 | 'transport' => 'ses',
50 | ],
51 |
52 | 'mailgun' => [
53 | 'transport' => 'mailgun',
54 | ],
55 |
56 | 'postmark' => [
57 | 'transport' => 'postmark',
58 | ],
59 |
60 | 'sendmail' => [
61 | 'transport' => 'sendmail',
62 | 'path' => '/usr/sbin/sendmail -bs',
63 | ],
64 |
65 | 'log' => [
66 | 'transport' => 'log',
67 | 'channel' => env('MAIL_LOG_CHANNEL'),
68 | ],
69 |
70 | 'array' => [
71 | 'transport' => 'array',
72 | ],
73 | ],
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Global "From" Address
78 | |--------------------------------------------------------------------------
79 | |
80 | | You may wish for all e-mails sent by your application to be sent from
81 | | the same address. Here, you may specify a name and address that is
82 | | used globally for all e-mails that are sent by your application.
83 | |
84 | */
85 |
86 | 'from' => [
87 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
88 | 'name' => env('MAIL_FROM_NAME', 'Example'),
89 | ],
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Markdown Mail Settings
94 | |--------------------------------------------------------------------------
95 | |
96 | | If you are using Markdown based email rendering, you may configure your
97 | | theme and component paths here, allowing you to customize the design
98 | | of the emails. Or, you may simply stick with the Laravel defaults!
99 | |
100 | */
101 |
102 | 'markdown' => [
103 | 'theme' => 'default',
104 |
105 | 'paths' => [
106 | resource_path('views/vendor/mail'),
107 | ],
108 | ],
109 |
110 | ];
111 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_CONNECTION', 'sync'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Queue Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure the connection information for each server that
24 | | is used by your application. A default configuration has been added
25 | | for each back-end shipped with Laravel. You are free to add more.
26 | |
27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
28 | |
29 | */
30 |
31 | 'connections' => [
32 |
33 | 'sync' => [
34 | 'driver' => 'sync',
35 | ],
36 |
37 | 'database' => [
38 | 'driver' => 'database',
39 | 'table' => 'jobs',
40 | 'queue' => 'default',
41 | 'retry_after' => 90,
42 | ],
43 |
44 | 'beanstalkd' => [
45 | 'driver' => 'beanstalkd',
46 | 'host' => 'localhost',
47 | 'queue' => 'default',
48 | 'retry_after' => 90,
49 | 'block_for' => 0,
50 | ],
51 |
52 | 'sqs' => [
53 | 'driver' => 'sqs',
54 | 'key' => env('AWS_ACCESS_KEY_ID'),
55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'),
58 | 'suffix' => env('SQS_SUFFIX'),
59 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
60 | ],
61 |
62 | 'redis' => [
63 | 'driver' => 'redis',
64 | 'connection' => 'default',
65 | 'queue' => env('REDIS_QUEUE', 'default'),
66 | 'retry_after' => 90,
67 | 'block_for' => null,
68 | ],
69 |
70 | ],
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | Failed Queue Jobs
75 | |--------------------------------------------------------------------------
76 | |
77 | | These options configure the behavior of failed queue job logging so you
78 | | can control which database and table are used to store the jobs that
79 | | have failed. You may change them to any database / table you wish.
80 | |
81 | */
82 |
83 | 'failed' => [
84 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
85 | 'database' => env('DB_CONNECTION', 'mysql'),
86 | 'table' => 'failed_jobs',
87 | ],
88 |
89 | ];
90 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
21 | ],
22 |
23 | 'postmark' => [
24 | 'token' => env('POSTMARK_TOKEN'),
25 | ],
26 |
27 | 'ses' => [
28 | 'key' => env('AWS_ACCESS_KEY_ID'),
29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
31 | ],
32 |
33 | 'github' => [
34 | 'client_id' => env('GITHUB_CLIENT_ID'),
35 | 'client_secret' => env('GITHUB_CLIENT_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | resource_path('views'),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => env(
32 | 'VIEW_COMPILED_PATH',
33 | realpath(storage_path('framework/views'))
34 | ),
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 | *.sqlite-journal
3 |
--------------------------------------------------------------------------------
/database/factories/UserFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->name,
27 | 'email' => $this->faker->unique()->safeEmail,
28 | 'email_verified_at' => now(),
29 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
30 | 'remember_token' => Str::random(10),
31 | ];
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->timestamp('email_verified_at')->nullable();
21 | $table->string('password')->nullable();
22 | $table->rememberToken();
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('users');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
18 | $table->string('token');
19 | $table->timestamp('created_at')->nullable();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('password_resets');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_12_07_122845_create_oauth_providers_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->bigInteger('user_id')->unsigned();
19 | $table->string('provider');
20 | $table->string('provider_user_id')->index();
21 | $table->string('access_token')->nullable();
22 | $table->string('refresh_token')->nullable();
23 | $table->timestamps();
24 |
25 | $table->foreign('user_id')
26 | ->references('id')
27 | ->on('users')
28 | ->onDelete('cascade');
29 | });
30 | }
31 |
32 | /**
33 | * Reverse the migrations.
34 | *
35 | * @return void
36 | */
37 | public function down()
38 | {
39 | Schema::dropIfExists('oauth_providers');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/database/migrations/2019_08_19_000000_create_failed_jobs_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('uuid')->unique();
19 | $table->text('connection');
20 | $table->text('queue');
21 | $table->longText('payload');
22 | $table->longText('exception');
23 | $table->timestamp('failed_at')->useCurrent();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('failed_jobs');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/seeders/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | create();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "dev": "mix",
5 | "development": "mix",
6 | "watch": "mix watch",
7 | "watch-poll": "mix watch -- --watch-options-poll=1000",
8 | "hot": "mix watch --hot",
9 | "prod": "mix --production",
10 | "production": "mix --production",
11 | "lint": "eslint --fix --ext .js,.vue resources/js"
12 | },
13 | "dependencies": {
14 | "axios": "^0.21.1",
15 | "js-cookie": "^2.2.1",
16 | "vform": "^1.0.1",
17 | "vue": "^2.6.12",
18 | "vue-clickaway": "^2.2.2",
19 | "vue-i18n": "^8.22.1",
20 | "vue-meta": "^2.4.0",
21 | "vue-router": "^3.4.8",
22 | "vuex": "^3.5.1",
23 | "vuex-router-sync": "^5.0.0"
24 | },
25 | "devDependencies": {
26 | "@babel/core": "^7.12.3",
27 | "@babel/eslint-parser": "^7.12.1",
28 | "@babel/plugin-syntax-dynamic-import": "^7.8.3",
29 | "@babel/preset-env": "^7.12.1",
30 | "autoprefixer": "^10.2.5",
31 | "cross-env": "^7.0.2",
32 | "eslint": "^7.12.1",
33 | "eslint-config-standard": "^16.0.1",
34 | "eslint-plugin-import": "^2.22.1",
35 | "eslint-plugin-node": "^11.1.0",
36 | "eslint-plugin-promise": "^4.2.1",
37 | "eslint-plugin-standard": "^4.0.2",
38 | "eslint-plugin-vue": "^7.1.0",
39 | "laravel-mix": "^6.0.18",
40 | "laravel-mix-versionhash": "^2.0.1",
41 | "postcss": "^8.2.10",
42 | "resolve-url-loader": "^3.1.2",
43 | "sass": "^1.28.0",
44 | "sass-loader": "^10.0.4",
45 | "tailwindcss": "^2.1.1",
46 | "vue-loader": "^15.9.6",
47 | "vue-template-compiler": "^2.6.12",
48 | "webpack-bundle-analyzer": "^3.9.0"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 | Success
21 | a fork from
6 | {{ $t('page_not_found') }}
7 |
8 |
9 |
6 |
28 |