├── .editorconfig
├── .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
├── client
├── assets
│ └── sass
│ │ ├── _variables.scss
│ │ ├── app.scss
│ │ └── elements
│ │ ├── _buttons.scss
│ │ ├── _card.scss
│ │ ├── _navbar.scss
│ │ └── _transitions.scss
├── components
│ ├── LocaleDropdown.vue
│ ├── Navbar.vue
│ └── global
│ │ ├── Button.vue
│ │ ├── Card.vue
│ │ ├── Checkbox.vue
│ │ ├── LoginWithGithub.vue
│ │ └── index.js
├── lang
│ ├── en.json
│ ├── es.json
│ └── zh-CN.json
├── layouts
│ ├── default.vue
│ └── simple.vue
├── middleware
│ ├── auth.js
│ ├── check-auth.js
│ ├── guest.js
│ └── locale.js
├── nuxt.config.js
├── pages
│ ├── auth
│ │ ├── login.vue
│ │ ├── password
│ │ │ ├── email.vue
│ │ │ └── reset.vue
│ │ ├── register.vue
│ │ └── verification
│ │ │ ├── resend.vue
│ │ │ └── verify.vue
│ ├── home.vue
│ ├── settings
│ │ ├── index.vue
│ │ ├── password.vue
│ │ └── profile.vue
│ └── welcome.vue
├── plugins
│ ├── axios.js
│ ├── bootstrap.js
│ ├── fontawesome.js
│ ├── i18n.js
│ ├── nuxt-client-init.js
│ └── vform.js
├── router.js
├── static
│ └── favicon.ico
├── store
│ ├── auth.js
│ ├── index.js
│ └── lang.js
└── utils
│ └── index.js
├── 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
├── lang
│ ├── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ ├── validation.php
│ │ └── verification.php
│ ├── es
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
│ └── zh-CN
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── errors
│ └── layout.blade.php
│ └── oauth
│ ├── callback.blade.php
│ └── emailTaken.blade.php
├── routes
├── api.php
├── channels.php
├── console.php
├── spa.php
└── web.php
├── server.php
├── storage
├── app
│ ├── .gitignore
│ └── public
│ │ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ ├── testing
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
└── tests
├── CreatesApplication.php
├── Feature
├── LocaleTest.php
├── LoginTest.php
├── OAuthTest.php
├── RegisterTest.php
├── SettingsTest.php
└── VerificationTest.php
├── TestCase.php
└── Unit
└── ExampleTest.php
/.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.example:
--------------------------------------------------------------------------------
1 | APP_NAME="Laravel Nuxt"
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_LOG_LEVEL=debug
6 | APP_URL=http://localhost:8000
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 | parserOptions: {
4 | parser: '@babel/eslint-parser',
5 | sourceType: 'module',
6 | requireConfigFile: false
7 | },
8 | extends: [
9 | '@nuxtjs'
10 | ],
11 | rules: {
12 | 'vue/max-attributes-per-line': 'off'
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.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 | steps:
13 | - name: Checkout code
14 | uses: actions/checkout@v2
15 |
16 | - name: Get Composer cache directory
17 | id: composer-cache
18 | run: |
19 | echo "::set-output name=dir::$(composer config cache-files-dir)"
20 |
21 | - uses: actions/cache@v2
22 | with:
23 | path: ${{ steps.composer-cache.outputs.dir }}
24 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
25 | restore-keys: |
26 | ${{ runner.os }}-composer-
27 |
28 | - uses: actions/cache@v2
29 | with:
30 | path: ~/.npm
31 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
32 | restore-keys: |
33 | ${{ runner.os }}-node-
34 |
35 | - name: Install composer dependencies
36 | run: composer install -q --no-ansi --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader
37 |
38 | - name: Directory permissions
39 | run: chmod -R 777 storage bootstrap/cache
40 |
41 | - name: Run tests (Unit and Feature)
42 | run: vendor/bin/phpunit
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /public/hot
3 | /public/storage
4 | /storage/*.key
5 | /vendor
6 | .env
7 | .env.backup
8 | .phpunit.result.cache
9 | Homestead.json
10 | Homestead.yaml
11 | npm-debug.log
12 | yarn-error.log
13 | .nuxt
14 | /dist
15 | /public/_nuxt
16 | *.code-workspace
17 |
--------------------------------------------------------------------------------
/.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 | }
27 |
--------------------------------------------------------------------------------
/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'), $this->resetUrl($notifiable))
21 | ->line(__('If you did not request a password reset, no further action is required.'));
22 | }
23 |
24 | /**
25 | * Get the reset password URL for the given notifiable.
26 | *
27 | * @param mixed $notifiable
28 | * @return string
29 | */
30 | protected function resetUrl($notifiable)
31 | {
32 | $appUrl = config('app.client_url', config('app.url'));
33 |
34 | return url("$appUrl/password/reset/$this->token").'?email='.urlencode($notifiable->email);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/Notifications/VerifyEmail.php:
--------------------------------------------------------------------------------
1 | addMinutes(60), ['user' => $notifiable->id]
23 | );
24 |
25 | return str_replace(url('/api'), $appUrl, $url);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | app->runningUnitTests()) {
18 | Schema::defaultStringLength(191);
19 | }
20 | }
21 |
22 | /**
23 | * Register any application services.
24 | *
25 | * @return void
26 | */
27 | public function register()
28 | {
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/client/assets/sass/_variables.scss:
--------------------------------------------------------------------------------
1 | // // Body
2 | $body-bg: #f7f9fb;
3 |
4 | // Cards
5 | $card-spacer-x: 0.9375rem;
6 | $card-spacer-y: 0.625rem;
7 | $card-cap-bg: #fbfbfb;
8 | $card-border-color: #e8eced;
9 |
10 | // Borders
11 | $border-radius: .125rem;
12 | $border-radius-lg: .2rem;
13 | $border-radius-sm: .15rem;
14 |
15 | // Nav Pills
16 | $nav-pills-border-radius: 0;
17 |
--------------------------------------------------------------------------------
/client/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | @import 'variables';
2 | @import '~bootstrap/scss/bootstrap';
3 | @import '~sweetalert2/src/sweetalert2';
4 | @import '~@fortawesome/fontawesome-svg-core/styles';
5 |
6 | @import 'elements/card';
7 | @import 'elements/navbar';
8 | @import 'elements/buttons';
9 | @import 'elements/transitions';
10 |
--------------------------------------------------------------------------------
/client/assets/sass/elements/_buttons.scss:
--------------------------------------------------------------------------------
1 | .btn-loading {
2 | position: relative;
3 | pointer-events: none;
4 | color: transparent !important;
5 |
6 | &:after {
7 | animation: spinAround 500ms infinite linear;
8 | border: 2px solid #dbdbdb;
9 | border-radius: 50%;
10 | border-right-color: transparent;
11 | border-top-color: transparent;
12 | content: "";
13 | display: block;
14 | height: 1em;
15 | width: 1em;
16 | position: absolute;
17 | left: calc(50% - (1em / 2));
18 | top: calc(50% - (1em / 2));
19 | }
20 | }
21 |
22 | @keyframes spinAround {
23 | from { transform: rotate(0deg); }
24 | to { transform: rotate(359deg); }
25 | }
26 |
--------------------------------------------------------------------------------
/client/assets/sass/elements/_card.scss:
--------------------------------------------------------------------------------
1 | .card {
2 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
3 | }
4 |
--------------------------------------------------------------------------------
/client/assets/sass/elements/_navbar.scss:
--------------------------------------------------------------------------------
1 | .navbar {
2 | font-weight: 600;
3 | box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
4 | }
5 |
6 | .nav-item {
7 | .dropdown-menu {
8 | border: none;
9 | margin-top: .5rem;
10 | border-top: 1px solid #f2f2f2 !important;
11 | box-shadow: 0 4px 8px 0 rgba(0,0,0,0.12), 0 2px 4px 0 rgba(0,0,0,0.08);
12 | }
13 | }
14 |
15 | .nav-link {
16 | .svg-inline--fa {
17 | font-size: 1.4rem;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/client/assets/sass/elements/_transitions.scss:
--------------------------------------------------------------------------------
1 | .page-enter-active,
2 | .page-leave-active {
3 | transition: opacity .2s;
4 | }
5 | .page-enter,
6 | .page-leave-to {
7 | opacity: 0;
8 | }
9 |
10 | .fade-enter-active,
11 | .fade-leave-active {
12 | transition: opacity .15s
13 | }
14 | .fade-enter,
15 | .fade-leave-to {
16 | opacity: 0
17 | }
18 |
--------------------------------------------------------------------------------
/client/components/LocaleDropdown.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 | {{ locales[locale] }}
7 |
8 |
15 |
16 |
17 |
18 |
39 |
--------------------------------------------------------------------------------
/client/components/Navbar.vue:
--------------------------------------------------------------------------------
1 |
2 |
62 |
63 |
64 |
92 |
93 |
100 |
--------------------------------------------------------------------------------
/client/components/global/Button.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
45 |
--------------------------------------------------------------------------------
/client/components/global/Card.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
22 |
--------------------------------------------------------------------------------
/client/components/global/Checkbox.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
14 |
15 |
16 |
17 |
67 |
--------------------------------------------------------------------------------
/client/components/global/LoginWithGithub.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
88 |
--------------------------------------------------------------------------------
/client/components/global/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 |
3 | const requireContext = require.context('./', false, /.*\.(vue)$/)
4 |
5 | requireContext.keys().forEach((file) => {
6 | const Component = requireContext(file).default
7 |
8 | if (Component.name) {
9 | Vue.component(Component.name, Component)
10 | }
11 | })
12 |
--------------------------------------------------------------------------------
/client/lang/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": "Ok",
3 | "cancel": "Cancel",
4 | "error_alert_title": "Oops...",
5 | "error_alert_text": "Something went wrong! Please try again.",
6 | "token_expired_alert_title": "Session Expired!",
7 | "token_expired_alert_text": "Please log in again to continue.",
8 | "login": "Log In",
9 | "register": "Register",
10 | "page_not_found": "Page Not Found",
11 | "go_home": "Go Home",
12 | "logout": "Logout",
13 | "email": "Email",
14 | "remember_me": "Remember Me",
15 | "password": "Password",
16 | "forgot_password": "Forgot Your Password?",
17 | "confirm_password": "Confirm Password",
18 | "name": "Name",
19 | "toggle_navigation": "Toggle navigation",
20 | "home": "Home",
21 | "you_are_logged_in": "You are logged in!",
22 | "reset_password": "Reset Password",
23 | "send_password_reset_link": "Send Password Reset Link",
24 | "settings": "Settings",
25 | "profile": "Profile",
26 | "your_info": "Your Info",
27 | "info_updated": "Your info has been updated!",
28 | "update": "Update",
29 | "your_password": "Your Password",
30 | "password_updated": "Your password has been updated!",
31 | "new_password": "New Password",
32 | "login_with": "Login with",
33 | "register_with": "Register with",
34 | "verify_email": "Verify Email",
35 | "send_verification_link": "Send Verification Link",
36 | "resend_verification_link": "Resend Verification Link ?",
37 | "failed_to_verify_email": "Failed to verify email.",
38 | "verify_email_address": "We sent you an email with an the verification link."
39 | }
40 |
--------------------------------------------------------------------------------
/client/lang/es.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": "De Acuerdo",
3 | "cancel": "Cancelar",
4 | "error_alert_title": "Ha ocurrido un problema",
5 | "error_alert_text": "¡Algo salió mal! Inténtalo de nuevo.",
6 | "token_expired_alert_title": "!Sesión Expirada!",
7 | "token_expired_alert_text": "Por favor inicie sesión de nuevo para continuar.",
8 | "login": "Iniciar Sesión",
9 | "register": "Registro",
10 | "page_not_found": "Página No Encontrada",
11 | "go_home": "Ir a Inicio",
12 | "logout": "Cerrar Sesión",
13 | "email": "Correo Electrónico",
14 | "remember_me": "Recuérdame",
15 | "password": "Contraseña",
16 | "forgot_password": "¿Olvidaste tu contraseña?",
17 | "confirm_password": "Confirmar Contraseña",
18 | "name": "Nombre",
19 | "toggle_navigation": "Cambiar Navegación",
20 | "home": "Inicio",
21 | "you_are_logged_in": "¡Has iniciado sesión!",
22 | "reset_password": "Restablecer la contraseña",
23 | "send_password_reset_link": "Enviar Enlace de Restablecimiento de Contraseña",
24 | "settings": "Configuraciones",
25 | "profile": "Perfil",
26 | "your_info": "Tu Información",
27 | "info_updated": "¡Tu información ha sido actualizada!",
28 | "update": "Actualizar",
29 | "your_password": "Tu Contraseña",
30 | "password_updated": "¡Tu contraseña ha sido actualizada!",
31 | "new_password": "Nueva Contraseña",
32 | "login_with": "Iniciar Sesión con",
33 | "register_with": "Registro con"
34 | }
35 |
--------------------------------------------------------------------------------
/client/lang/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "ok": "确定",
3 | "cancel": "取消",
4 | "error_alert_title": "错误...",
5 | "error_alert_text": "遇到一些错误,请稍后重试~",
6 | "token_expired_alert_title": "验证过期!",
7 | "token_expired_alert_text": "请稍后重新登录系统",
8 | "login": "登录",
9 | "register": "注册",
10 | "page_not_found": "页面不存在",
11 | "go_home": "返回首页",
12 | "logout": "退出",
13 | "email": "邮箱",
14 | "remember_me": "记住我",
15 | "password": "密码",
16 | "forgot_password": "忘记密码?",
17 | "confirm_password": "重复密码",
18 | "name": "用户名",
19 | "toggle_navigation": "切换导航",
20 | "home": "首页",
21 | "you_are_logged_in": "您已经登录!",
22 | "reset_password": "重置密码",
23 | "send_password_reset_link": "发送重置链接",
24 | "settings": "设置",
25 | "profile": "个人设置",
26 | "your_info": "您的个人信息",
27 | "info_updated": "您的个人信息已经更改!",
28 | "update": "更新",
29 | "your_password": "您的密码",
30 | "password_updated": "您的密码已经更新!",
31 | "new_password": "新密码",
32 | "login_with": "登录",
33 | "register_with": "注册"
34 | }
35 |
--------------------------------------------------------------------------------
/client/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
20 |
--------------------------------------------------------------------------------
/client/layouts/simple.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
25 |
--------------------------------------------------------------------------------
/client/middleware/auth.js:
--------------------------------------------------------------------------------
1 | export default ({ store, redirect }) => {
2 | if (!store.getters['auth/check']) {
3 | return redirect('/login')
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/client/middleware/check-auth.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 |
3 | export default async ({ store, req }) => {
4 | const token = store.getters['auth/token']
5 |
6 | if (process.server) {
7 | if (token) {
8 | axios.defaults.headers.common.Authorization = `Bearer ${token}`
9 | } else {
10 | delete axios.defaults.headers.common.Authorization
11 | }
12 | }
13 |
14 | if (!store.getters['auth/check'] && token) {
15 | await store.dispatch('auth/fetchUser')
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/client/middleware/guest.js:
--------------------------------------------------------------------------------
1 | export default ({ store, redirect }) => {
2 | if (store.getters['auth/check']) {
3 | return redirect('/')
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/client/middleware/locale.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import { loadMessages } from '~/plugins/i18n'
3 |
4 | export default async ({ store }) => {
5 | if (process.server) {
6 | const locale = store.getters['lang/locale']
7 | if (locale) {
8 | axios.defaults.headers.common['Accept-Language'] = locale
9 | }
10 | }
11 |
12 | await loadMessages(store.getters['lang/locale'])
13 | }
14 |
--------------------------------------------------------------------------------
/client/nuxt.config.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config()
2 | const { join } = require('path')
3 | const { copySync, removeSync } = require('fs-extra')
4 |
5 | module.exports = {
6 | ssr: false,
7 |
8 | srcDir: __dirname,
9 |
10 | env: {
11 | apiUrl: process.env.API_URL || process.env.APP_URL + '/api',
12 | appName: process.env.APP_NAME || 'Laravel Nuxt',
13 | appLocale: process.env.APP_LOCALE || 'en',
14 | githubAuth: !!process.env.GITHUB_CLIENT_ID
15 | },
16 |
17 | head: {
18 | title: process.env.APP_NAME,
19 | titleTemplate: '%s - ' + process.env.APP_NAME,
20 | meta: [
21 | { charset: 'utf-8' },
22 | { name: 'viewport', content: 'width=device-width, initial-scale=1' },
23 | { hid: 'description', name: 'description', content: 'Nuxt.js project' }
24 | ],
25 | link: [
26 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
27 | ]
28 | },
29 |
30 | loading: { color: '#007bff' },
31 |
32 | router: {
33 | middleware: ['locale', 'check-auth']
34 | },
35 |
36 | css: [
37 | { src: '~assets/sass/app.scss', lang: 'scss' }
38 | ],
39 |
40 | plugins: [
41 | '~components/global',
42 | '~plugins/i18n',
43 | '~plugins/vform',
44 | '~plugins/axios',
45 | '~plugins/fontawesome',
46 | '~plugins/nuxt-client-init',
47 | { src: '~plugins/bootstrap', mode: 'client' }
48 | ],
49 |
50 | modules: [
51 | '@nuxtjs/router'
52 | ],
53 |
54 | build: {
55 | extractCSS: true
56 | },
57 |
58 | hooks: {
59 | generate: {
60 | done (generator) {
61 | // Copy dist files to public/_nuxt
62 | if (generator.nuxt.options.dev === false && generator.nuxt.options.mode === 'spa') {
63 | const publicDir = join(generator.nuxt.options.rootDir, 'public', '_nuxt')
64 | removeSync(publicDir)
65 | copySync(join(generator.nuxt.options.generate.dir, '_nuxt'), publicDir)
66 | copySync(join(generator.nuxt.options.generate.dir, '200.html'), join(publicDir, 'index.html'))
67 | removeSync(generator.nuxt.options.generate.dir)
68 | }
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/client/pages/auth/login.vue:
--------------------------------------------------------------------------------
1 |
2 |
53 |
54 |
55 |
100 |
--------------------------------------------------------------------------------
/client/pages/auth/password/email.vue:
--------------------------------------------------------------------------------
1 |
2 |
29 |
30 |
31 |
56 |
--------------------------------------------------------------------------------
/client/pages/auth/password/reset.vue:
--------------------------------------------------------------------------------
1 |
2 |
47 |
48 |
49 |
84 |
--------------------------------------------------------------------------------
/client/pages/auth/register.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{ $t('verify_email_address') }}
7 |
8 |
9 |
10 |
61 |
62 |
63 |
64 |
65 |
66 |
118 |
--------------------------------------------------------------------------------
/client/pages/auth/verification/resend.vue:
--------------------------------------------------------------------------------
1 |
2 |
29 |
30 |
31 |
64 |
--------------------------------------------------------------------------------
/client/pages/auth/verification/verify.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{ status }}
8 |
9 |
10 |
11 | {{ $t('login') }}
12 |
13 |
14 |
15 |
16 | {{ status || $t('failed_to_verify_email') }}
17 |
18 |
19 |
20 | {{ $t('resend_verification_link') }}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
51 |
--------------------------------------------------------------------------------
/client/pages/home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ $t('you_are_logged_in') }}
4 |
5 |
6 |
7 |
16 |
--------------------------------------------------------------------------------
/client/pages/settings/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | -
7 |
8 |
9 | {{ tab.name }}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
46 |
47 |
52 |
--------------------------------------------------------------------------------
/client/pages/settings/password.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
33 |
34 |
35 |
36 |
62 |
--------------------------------------------------------------------------------
/client/pages/settings/profile.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
33 |
34 |
35 |
36 |
74 |
--------------------------------------------------------------------------------
/client/pages/welcome.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{ $t('home') }}
7 |
8 |
9 |
10 |
11 | {{ $t('login') }}
12 |
13 |
14 | {{ $t('register') }}
15 |
16 |
17 |
18 |
19 |
20 |
21 | LaravelNuxt
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
51 |
52 |
71 |
--------------------------------------------------------------------------------
/client/plugins/axios.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import Swal from 'sweetalert2'
3 |
4 | // process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
5 |
6 | export default ({ app, store, redirect }) => {
7 | axios.defaults.baseURL = process.env.apiUrl
8 |
9 | if (process.server) {
10 | return
11 | }
12 |
13 | // Request interceptor
14 | axios.interceptors.request.use((request) => {
15 | request.baseURL = process.env.apiUrl
16 |
17 | const token = store.getters['auth/token']
18 |
19 | if (token) {
20 | request.headers.common.Authorization = `Bearer ${token}`
21 | }
22 |
23 | const locale = store.getters['lang/locale']
24 | if (locale) {
25 | request.headers.common['Accept-Language'] = locale
26 | }
27 |
28 | return request
29 | })
30 |
31 | // Response interceptor
32 | axios.interceptors.response.use(response => response, (error) => {
33 | const { status } = error.response || {}
34 |
35 | if (status >= 500) {
36 | Swal.fire({
37 | icon: 'error',
38 | title: app.i18n.t('error_alert_title'),
39 | text: app.i18n.t('error_alert_text'),
40 | reverseButtons: true,
41 | confirmButtonText: app.i18n.t('ok'),
42 | cancelButtonText: app.i18n.t('cancel')
43 | })
44 | }
45 |
46 | if (status === 401 && store.getters['auth/check']) {
47 | Swal.fire({
48 | icon: 'warning',
49 | title: app.i18n.t('token_expired_alert_title'),
50 | text: app.i18n.t('token_expired_alert_text'),
51 | reverseButtons: true,
52 | confirmButtonText: app.i18n.t('ok'),
53 | cancelButtonText: app.i18n.t('cancel')
54 | }).then(() => {
55 | store.commit('auth/LOGOUT')
56 |
57 | redirect({ name: 'login' })
58 | })
59 | }
60 |
61 | return Promise.reject(error)
62 | })
63 | }
64 |
--------------------------------------------------------------------------------
/client/plugins/bootstrap.js:
--------------------------------------------------------------------------------
1 | import 'bootstrap'
2 |
--------------------------------------------------------------------------------
/client/plugins/fontawesome.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import { library, config } from '@fortawesome/fontawesome-svg-core'
3 | import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
4 |
5 | import {
6 | faUser, faLock, faSignOutAlt, faCog
7 | } from '@fortawesome/free-solid-svg-icons'
8 |
9 | import {
10 | faGithub
11 | } from '@fortawesome/free-brands-svg-icons'
12 |
13 | config.autoAddCss = false
14 |
15 | library.add(
16 | faUser, faLock, faSignOutAlt, faCog, faGithub
17 | )
18 |
19 | Vue.component('Fa', FontAwesomeIcon)
20 |
--------------------------------------------------------------------------------
/client/plugins/i18n.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueI18n from 'vue-i18n'
3 |
4 | Vue.use(VueI18n)
5 |
6 | const i18n = new VueI18n({
7 | locale: 'en',
8 | messages: {}
9 | })
10 |
11 | export default async ({ app, store }) => {
12 | if (process.client) {
13 | await loadMessages(store.getters['lang/locale'])
14 | }
15 |
16 | app.i18n = i18n
17 | }
18 |
19 | /**
20 | * @param {String} locale
21 | */
22 | export async function loadMessages (locale) {
23 | if (Object.keys(i18n.getLocaleMessage(locale)).length === 0) {
24 | const messages = await import(/* webpackChunkName: "lang-[request]" */ `~/lang/${locale}`)
25 | i18n.setLocaleMessage(locale, messages)
26 | }
27 |
28 | if (i18n.locale !== locale) {
29 | i18n.locale = locale
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/client/plugins/nuxt-client-init.js:
--------------------------------------------------------------------------------
1 | export default (ctx) => {
2 | ctx.store.dispatch('nuxtClientInit', ctx)
3 | }
4 |
--------------------------------------------------------------------------------
/client/plugins/vform.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import { HasError, AlertError, AlertSuccess } from 'vform'
3 |
4 | Vue.component(HasError.name, HasError)
5 | Vue.component(AlertError.name, AlertError)
6 | Vue.component(AlertSuccess.name, AlertSuccess)
7 |
--------------------------------------------------------------------------------
/client/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import { scrollBehavior } from '~/utils'
4 |
5 | Vue.use(Router)
6 |
7 | const page = path => () => import(`~/pages/${path}`).then(m => m.default || m)
8 |
9 | const routes = [
10 | { path: '/', name: 'welcome', component: page('welcome.vue') },
11 |
12 | { path: '/login', name: 'login', component: page('auth/login.vue') },
13 | { path: '/register', name: 'register', component: page('auth/register.vue') },
14 | { path: '/password/reset', name: 'password.request', component: page('auth/password/email.vue') },
15 | { path: '/password/reset/:token', name: 'password.reset', component: page('auth/password/reset.vue') },
16 | { path: '/email/verify/:id', name: 'verification.verify', component: page('auth/verification/verify.vue') },
17 | { path: '/email/resend', name: 'verification.resend', component: page('auth/verification/resend.vue') },
18 |
19 | { path: '/home', name: 'home', component: page('home.vue') },
20 | {
21 | path: '/settings',
22 | component: page('settings/index.vue'),
23 | children: [
24 | { path: '', redirect: { name: 'settings.profile' } },
25 | { path: 'profile', name: 'settings.profile', component: page('settings/profile.vue') },
26 | { path: 'password', name: 'settings.password', component: page('settings/password.vue') }
27 | ]
28 | }
29 | ]
30 |
31 | export function createRouter () {
32 | return new Router({
33 | routes,
34 | scrollBehavior,
35 | mode: 'history'
36 | })
37 | }
38 |
--------------------------------------------------------------------------------
/client/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cretueusebiu/laravel-nuxt/5e11260d91c32924847fb32053ffecabe89207bd/client/static/favicon.ico
--------------------------------------------------------------------------------
/client/store/auth.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import Cookies from 'js-cookie'
3 |
4 | // state
5 | export const state = () => ({
6 | user: null,
7 | token: null
8 | })
9 |
10 | // getters
11 | export const getters = {
12 | user: state => state.user,
13 | token: state => state.token,
14 | check: state => state.user !== null
15 | }
16 |
17 | // mutations
18 | export const mutations = {
19 | SET_TOKEN (state, token) {
20 | state.token = token
21 | },
22 |
23 | FETCH_USER_SUCCESS (state, user) {
24 | state.user = user
25 | },
26 |
27 | FETCH_USER_FAILURE (state) {
28 | state.token = null
29 | },
30 |
31 | LOGOUT (state) {
32 | state.user = null
33 | state.token = null
34 | },
35 |
36 | UPDATE_USER (state, { user }) {
37 | state.user = user
38 | }
39 | }
40 |
41 | // actions
42 | export const actions = {
43 | saveToken ({ commit, dispatch }, { token, remember }) {
44 | commit('SET_TOKEN', token)
45 |
46 | Cookies.set('token', token, { expires: remember ? 365 : null })
47 | },
48 |
49 | async fetchUser ({ commit }) {
50 | try {
51 | const { data } = await axios.get('/user')
52 |
53 | commit('FETCH_USER_SUCCESS', data)
54 | } catch (e) {
55 | Cookies.remove('token')
56 |
57 | commit('FETCH_USER_FAILURE')
58 | }
59 | },
60 |
61 | updateUser ({ commit }, payload) {
62 | commit('UPDATE_USER', payload)
63 | },
64 |
65 | async logout ({ commit }) {
66 | try {
67 | await axios.post('/logout')
68 | } catch (e) { }
69 |
70 | Cookies.remove('token')
71 |
72 | commit('LOGOUT')
73 | },
74 |
75 | async fetchOauthUrl (ctx, { provider }) {
76 | const { data } = await axios.post(`/oauth/${provider}`)
77 |
78 | return data.url
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/client/store/index.js:
--------------------------------------------------------------------------------
1 | import Cookies from 'js-cookie'
2 | import { cookieFromRequest } from '~/utils'
3 |
4 | export const actions = {
5 | nuxtServerInit ({ commit }, { req }) {
6 | const token = cookieFromRequest(req, 'token')
7 | if (token) {
8 | commit('auth/SET_TOKEN', token)
9 | }
10 |
11 | const locale = cookieFromRequest(req, 'locale')
12 | if (locale) {
13 | commit('lang/SET_LOCALE', { locale })
14 | }
15 | },
16 |
17 | nuxtClientInit ({ commit, getters }) {
18 | const token = Cookies.get('token')
19 | if (token && !getters['auth/token']) {
20 | commit('auth/SET_TOKEN', token)
21 | }
22 |
23 | const locale = Cookies.get('locale')
24 | if (locale && !getters['lang/locale']) {
25 | commit('lang/SET_LOCALE', { locale })
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/client/store/lang.js:
--------------------------------------------------------------------------------
1 | import Cookies from 'js-cookie'
2 |
3 | // state
4 | export const state = () => ({
5 | locale: process.env.appLocale,
6 | locales: {
7 | en: 'EN',
8 | 'zh-CN': '中文',
9 | es: 'ES'
10 | }
11 | })
12 |
13 | // getters
14 | export const getters = {
15 | locale: state => state.locale,
16 | locales: state => state.locales
17 | }
18 |
19 | // mutations
20 | export const mutations = {
21 | SET_LOCALE (state, { locale }) {
22 | state.locale = locale
23 | }
24 | }
25 |
26 | // actions
27 | export const actions = {
28 | setLocale ({ commit }, { locale }) {
29 | commit('SET_LOCALE', { locale })
30 |
31 | Cookies.set('locale', locale, { expires: 365 })
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/client/utils/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Get cookie from request.
3 | *
4 | * @param {Object} req
5 | * @param {String} key
6 | * @return {String|undefined}
7 | */
8 | export function cookieFromRequest (req, key) {
9 | if (!req.headers.cookie) {
10 | return
11 | }
12 |
13 | const cookie = req.headers.cookie.split(';').find(
14 | c => c.trim().startsWith(`${key}=`)
15 | )
16 |
17 | if (cookie) {
18 | return cookie.split('=')[1]
19 | }
20 | }
21 |
22 | /**
23 | * https://router.vuejs.org/en/advanced/scroll-behavior.html
24 | */
25 | export function scrollBehavior (to, from, savedPosition) {
26 | if (savedPosition) {
27 | return savedPosition
28 | }
29 |
30 | let position = {}
31 |
32 | if (to.matched.length < 2) {
33 | position = { x: 0, y: 0 }
34 | } else if (to.matched.some(r => r.components.default.options.scrollToTop)) {
35 | position = { x: 0, y: 0 }
36 | } if (to.hash) {
37 | position = { selector: to.hash }
38 | }
39 |
40 | return position
41 | }
42 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cretueusebiu/laravel-nuxt",
3 | "description": "A Laravel-Nuxt starter project template.",
4 | "keywords": ["laravel", "nuxt", "vue", "spa"],
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.12",
13 | "laravel/socialite": "^5.0",
14 | "laravel/tinker": "^2.5",
15 | "laravel/ui": "^3.0",
16 | "tymon/jwt-auth": "^1.0.1"
17 | },
18 | "require-dev": {
19 | "doctrine/dbal": "^2.12",
20 | "facade/ignition": "^2.5",
21 | "fakerphp/faker": "^1.9.1",
22 | "mockery/mockery": "^1.4.2",
23 | "nunomaduro/collision": "^5.0",
24 | "phpunit/phpunit": "^9.3.3"
25 | },
26 | "config": {
27 | "optimize-autoloader": true,
28 | "preferred-install": "dist",
29 | "sort-packages": true
30 | },
31 | "extra": {
32 | "laravel": {
33 | "dont-discover": [
34 | ]
35 | }
36 | },
37 | "autoload": {
38 | "psr-4": {
39 | "App\\": "app/",
40 | "Database\\Factories\\": "database/factories/",
41 | "Database\\Seeders\\": "database/seeders/"
42 | }
43 | },
44 | "autoload-dev": {
45 | "psr-4": {
46 | "Tests\\": "tests/"
47 | }
48 | },
49 | "minimum-stability": "dev",
50 | "prefer-stable": true,
51 | "scripts": {
52 | "post-autoload-dump": [
53 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
54 | "@php artisan package:discover --ansi"
55 | ],
56 | "post-root-package-install": [
57 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
58 | ],
59 | "post-create-project-cmd": [
60 | "@php artisan key:generate --ansi",
61 | "@php artisan jwt:secret --force --ansi"
62 | ]
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/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/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Database Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here are each of the database connections setup for your application.
26 | | Of course, examples of configuring each database platform that is
27 | | supported by Laravel is shown below to make development simple.
28 | |
29 | |
30 | | All database work in Laravel is done through the PHP PDO facilities
31 | | so make sure you have the driver for your particular database of
32 | | choice installed on your machine before you begin development.
33 | |
34 | */
35 |
36 | 'connections' => [
37 |
38 | 'sqlite' => [
39 | 'driver' => 'sqlite',
40 | 'url' => env('DATABASE_URL'),
41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
42 | 'prefix' => '',
43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
44 | ],
45 |
46 | 'mysql' => [
47 | 'driver' => 'mysql',
48 | 'url' => env('DATABASE_URL'),
49 | 'host' => env('DB_HOST', '127.0.0.1'),
50 | 'port' => env('DB_PORT', '3306'),
51 | 'database' => env('DB_DATABASE', 'forge'),
52 | 'username' => env('DB_USERNAME', 'forge'),
53 | 'password' => env('DB_PASSWORD', ''),
54 | 'unix_socket' => env('DB_SOCKET', ''),
55 | 'charset' => 'utf8mb4',
56 | 'collation' => 'utf8mb4_unicode_ci',
57 | 'prefix' => '',
58 | 'prefix_indexes' => true,
59 | 'strict' => true,
60 | 'engine' => null,
61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([
62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
63 | ]) : [],
64 | ],
65 |
66 | 'pgsql' => [
67 | 'driver' => 'pgsql',
68 | 'url' => env('DATABASE_URL'),
69 | 'host' => env('DB_HOST', '127.0.0.1'),
70 | 'port' => env('DB_PORT', '5432'),
71 | 'database' => env('DB_DATABASE', 'forge'),
72 | 'username' => env('DB_USERNAME', 'forge'),
73 | 'password' => env('DB_PASSWORD', ''),
74 | 'charset' => 'utf8',
75 | 'prefix' => '',
76 | 'prefix_indexes' => true,
77 | 'schema' => 'public',
78 | 'sslmode' => 'prefer',
79 | ],
80 |
81 | 'sqlsrv' => [
82 | 'driver' => 'sqlsrv',
83 | 'url' => env('DATABASE_URL'),
84 | 'host' => env('DB_HOST', 'localhost'),
85 | 'port' => env('DB_PORT', '1433'),
86 | 'database' => env('DB_DATABASE', 'forge'),
87 | 'username' => env('DB_USERNAME', 'forge'),
88 | 'password' => env('DB_PASSWORD', ''),
89 | 'charset' => 'utf8',
90 | 'prefix' => '',
91 | 'prefix_indexes' => true,
92 | ],
93 |
94 | ],
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Migration Repository Table
99 | |--------------------------------------------------------------------------
100 | |
101 | | This table keeps track of all the migrations that have already run for
102 | | your application. Using this information, we can determine which of
103 | | the migrations on disk haven't actually been run in the database.
104 | |
105 | */
106 |
107 | 'migrations' => 'migrations',
108 |
109 | /*
110 | |--------------------------------------------------------------------------
111 | | Redis Databases
112 | |--------------------------------------------------------------------------
113 | |
114 | | Redis is an open source, fast, and advanced key-value store that also
115 | | provides a richer body of commands than a typical key-value system
116 | | such as APC or Memcached. Laravel makes it easy to dig right in.
117 | |
118 | */
119 |
120 | 'redis' => [
121 |
122 | 'client' => env('REDIS_CLIENT', 'phpredis'),
123 |
124 | 'options' => [
125 | 'cluster' => env('REDIS_CLUSTER', 'redis'),
126 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
127 | ],
128 |
129 | 'default' => [
130 | 'url' => env('REDIS_URL'),
131 | 'host' => env('REDIS_HOST', '127.0.0.1'),
132 | 'password' => env('REDIS_PASSWORD', null),
133 | 'port' => env('REDIS_PORT', '6379'),
134 | 'database' => env('REDIS_DB', '0'),
135 | ],
136 |
137 | 'cache' => [
138 | 'url' => env('REDIS_URL'),
139 | 'host' => env('REDIS_HOST', '127.0.0.1'),
140 | 'password' => env('REDIS_PASSWORD', null),
141 | 'port' => env('REDIS_PORT', '6379'),
142 | 'database' => env('REDIS_CACHE_DB', '1'),
143 | ],
144 |
145 | ],
146 |
147 | ];
148 |
--------------------------------------------------------------------------------
/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/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Session Lifetime
26 | |--------------------------------------------------------------------------
27 | |
28 | | Here you may specify the number of minutes that you wish the session
29 | | to be allowed to remain idle before it expires. If you want them
30 | | to immediately expire on the browser closing, set that option.
31 | |
32 | */
33 |
34 | 'lifetime' => env('SESSION_LIFETIME', 120),
35 |
36 | 'expire_on_close' => false,
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Session Encryption
41 | |--------------------------------------------------------------------------
42 | |
43 | | This option allows you to easily specify that all of your session data
44 | | should be encrypted before it is stored. All encryption will be run
45 | | automatically by Laravel and you can use the Session like normal.
46 | |
47 | */
48 |
49 | 'encrypt' => false,
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | Session File Location
54 | |--------------------------------------------------------------------------
55 | |
56 | | When using the native session driver, we need a location where session
57 | | files may be stored. A default has been set for you but a different
58 | | location may be specified. This is only needed for file sessions.
59 | |
60 | */
61 |
62 | 'files' => storage_path('framework/sessions'),
63 |
64 | /*
65 | |--------------------------------------------------------------------------
66 | | Session Database Connection
67 | |--------------------------------------------------------------------------
68 | |
69 | | When using the "database" or "redis" session drivers, you may specify a
70 | | connection that should be used to manage these sessions. This should
71 | | correspond to a connection in your database configuration options.
72 | |
73 | */
74 |
75 | 'connection' => env('SESSION_CONNECTION', null),
76 |
77 | /*
78 | |--------------------------------------------------------------------------
79 | | Session Database Table
80 | |--------------------------------------------------------------------------
81 | |
82 | | When using the "database" session driver, you may specify the table we
83 | | should use to manage the sessions. Of course, a sensible default is
84 | | provided for you; however, you are free to change this as needed.
85 | |
86 | */
87 |
88 | 'table' => 'sessions',
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Session Cache Store
93 | |--------------------------------------------------------------------------
94 | |
95 | | While using one of the framework's cache driven session backends you may
96 | | list a cache store that should be used for these sessions. This value
97 | | must match with one of the application's configured cache "stores".
98 | |
99 | | Affects: "apc", "dynamodb", "memcached", "redis"
100 | |
101 | */
102 |
103 | 'store' => env('SESSION_STORE', null),
104 |
105 | /*
106 | |--------------------------------------------------------------------------
107 | | Session Sweeping Lottery
108 | |--------------------------------------------------------------------------
109 | |
110 | | Some session drivers must manually sweep their storage location to get
111 | | rid of old sessions from storage. Here are the chances that it will
112 | | happen on a given request. By default, the odds are 2 out of 100.
113 | |
114 | */
115 |
116 | 'lottery' => [2, 100],
117 |
118 | /*
119 | |--------------------------------------------------------------------------
120 | | Session Cookie Name
121 | |--------------------------------------------------------------------------
122 | |
123 | | Here you may change the name of the cookie used to identify a session
124 | | instance by ID. The name specified here will get used every time a
125 | | new session cookie is created by the framework for every driver.
126 | |
127 | */
128 |
129 | 'cookie' => env(
130 | 'SESSION_COOKIE',
131 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
132 | ),
133 |
134 | /*
135 | |--------------------------------------------------------------------------
136 | | Session Cookie Path
137 | |--------------------------------------------------------------------------
138 | |
139 | | The session cookie path determines the path for which the cookie will
140 | | be regarded as available. Typically, this will be the root path of
141 | | your application but you are free to change this when necessary.
142 | |
143 | */
144 |
145 | 'path' => '/',
146 |
147 | /*
148 | |--------------------------------------------------------------------------
149 | | Session Cookie Domain
150 | |--------------------------------------------------------------------------
151 | |
152 | | Here you may change the domain of the cookie used to identify a session
153 | | in your application. This will determine which domains the cookie is
154 | | available to in your application. A sensible default has been set.
155 | |
156 | */
157 |
158 | 'domain' => env('SESSION_DOMAIN', null),
159 |
160 | /*
161 | |--------------------------------------------------------------------------
162 | | HTTPS Only Cookies
163 | |--------------------------------------------------------------------------
164 | |
165 | | By setting this option to true, session cookies will only be sent back
166 | | to the server if the browser has a HTTPS connection. This will keep
167 | | the cookie from being sent to you if it can not be done securely.
168 | |
169 | */
170 |
171 | 'secure' => env('SESSION_SECURE_COOKIE'),
172 |
173 | /*
174 | |--------------------------------------------------------------------------
175 | | HTTP Access Only
176 | |--------------------------------------------------------------------------
177 | |
178 | | Setting this value to true will prevent JavaScript from accessing the
179 | | value of the cookie and the cookie will only be accessible through
180 | | the HTTP protocol. You are free to modify this option if needed.
181 | |
182 | */
183 |
184 | 'http_only' => true,
185 |
186 | /*
187 | |--------------------------------------------------------------------------
188 | | Same-Site Cookies
189 | |--------------------------------------------------------------------------
190 | |
191 | | This option determines how your cookies behave when cross-site requests
192 | | take place, and can be used to mitigate CSRF attacks. By default, we
193 | | will set this value to "lax" since this is a secure default value.
194 | |
195 | | Supported: "lax", "strict", "none", null
196 | |
197 | */
198 |
199 | 'same_site' => 'lax',
200 |
201 | ];
202 |
--------------------------------------------------------------------------------
/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": "nuxt -c client/nuxt.config.js",
5 | "build": "nuxt build -c client/nuxt.config.js",
6 | "start": "nuxt start -c client/nuxt.config.js",
7 | "lint": "eslint --fix --ext .js,.vue client/"
8 | },
9 | "dependencies": {
10 | "@fortawesome/fontawesome-svg-core": "^1.2.32",
11 | "@fortawesome/free-brands-svg-icons": "^5.15.1",
12 | "@fortawesome/free-regular-svg-icons": "^5.15.1",
13 | "@fortawesome/free-solid-svg-icons": "^5.15.1",
14 | "@fortawesome/vue-fontawesome": "^2.0.0",
15 | "@nuxtjs/router": "^1.5.0",
16 | "axios": "^0.21.0",
17 | "bootstrap": "^4.5.3",
18 | "dotenv": "^8.2.0",
19 | "jquery": "^3.5.1",
20 | "js-cookie": "^2.2.1",
21 | "nuxt": "^2.14.7",
22 | "popper.js": "^1.16.1",
23 | "sweetalert2": "^10.10.4",
24 | "vform": "^1.0.1",
25 | "vue-i18n": "^8.22.2"
26 | },
27 | "devDependencies": {
28 | "@babel/eslint-parser": "^7.12.1",
29 | "@nuxtjs/eslint-config": "^5.0.0",
30 | "eslint": "^7.14.0",
31 | "fs-extra": "^9.0.1",
32 | "node-sass": "^5.0.0",
33 | "sass-loader": "^10.1.0"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | ./tests/Unit
10 |
11 |
12 | ./tests/Feature
13 |
14 |
15 |
16 |
17 | ./app
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Send Requests To Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cretueusebiu/laravel-nuxt/5e11260d91c32924847fb32053ffecabe89207bd/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class);
50 |
51 | $response = tap($kernel->handle(
52 | $request = Request::capture()
53 | ))->send();
54 |
55 | $kernel->terminate($request, $response);
56 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/public/web.config:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/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 | 'Your password has been reset!',
17 | 'sent' => 'We have emailed your password reset link!',
18 | 'throttled' => 'Please wait before retrying.',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that email address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20 | 'alpha' => 'The :attribute may only contain letters.',
21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
23 | 'array' => 'The :attribute must be an array.',
24 | 'before' => 'The :attribute must be a date before :date.',
25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
26 | 'between' => [
27 | 'numeric' => 'The :attribute must be between :min and :max.',
28 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
29 | 'string' => 'The :attribute must be between :min and :max characters.',
30 | 'array' => 'The :attribute must have between :min and :max items.',
31 | ],
32 | 'boolean' => 'The :attribute field must be true or false.',
33 | 'confirmed' => 'The :attribute confirmation does not match.',
34 | 'date' => 'The :attribute is not a valid date.',
35 | 'date_equals' => 'The :attribute must be a date equal to :date.',
36 | 'date_format' => 'The :attribute does not match the format :format.',
37 | 'different' => 'The :attribute and :other must be different.',
38 | 'digits' => 'The :attribute must be :digits digits.',
39 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
40 | 'dimensions' => 'The :attribute has invalid image dimensions.',
41 | 'distinct' => 'The :attribute field has a duplicate value.',
42 | 'email' => 'The :attribute must be a valid email address.',
43 | 'ends_with' => 'The :attribute must end with one of the following: :values.',
44 | 'exists' => 'The selected :attribute is invalid.',
45 | 'file' => 'The :attribute must be a file.',
46 | 'filled' => 'The :attribute field must have a value.',
47 | 'gt' => [
48 | 'numeric' => 'The :attribute must be greater than :value.',
49 | 'file' => 'The :attribute must be greater than :value kilobytes.',
50 | 'string' => 'The :attribute must be greater than :value characters.',
51 | 'array' => 'The :attribute must have more than :value items.',
52 | ],
53 | 'gte' => [
54 | 'numeric' => 'The :attribute must be greater than or equal :value.',
55 | 'file' => 'The :attribute must be greater than or equal :value kilobytes.',
56 | 'string' => 'The :attribute must be greater than or equal :value characters.',
57 | 'array' => 'The :attribute must have :value items or more.',
58 | ],
59 | 'image' => 'The :attribute must be an image.',
60 | 'in' => 'The selected :attribute is invalid.',
61 | 'in_array' => 'The :attribute field does not exist in :other.',
62 | 'integer' => 'The :attribute must be an integer.',
63 | 'ip' => 'The :attribute must be a valid IP address.',
64 | 'ipv4' => 'The :attribute must be a valid IPv4 address.',
65 | 'ipv6' => 'The :attribute must be a valid IPv6 address.',
66 | 'json' => 'The :attribute must be a valid JSON string.',
67 | 'lt' => [
68 | 'numeric' => 'The :attribute must be less than :value.',
69 | 'file' => 'The :attribute must be less than :value kilobytes.',
70 | 'string' => 'The :attribute must be less than :value characters.',
71 | 'array' => 'The :attribute must have less than :value items.',
72 | ],
73 | 'lte' => [
74 | 'numeric' => 'The :attribute must be less than or equal :value.',
75 | 'file' => 'The :attribute must be less than or equal :value kilobytes.',
76 | 'string' => 'The :attribute must be less than or equal :value characters.',
77 | 'array' => 'The :attribute must not have more than :value items.',
78 | ],
79 | 'max' => [
80 | 'numeric' => 'The :attribute may not be greater than :max.',
81 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
82 | 'string' => 'The :attribute may not be greater than :max characters.',
83 | 'array' => 'The :attribute may not have more than :max items.',
84 | ],
85 | 'mimes' => 'The :attribute must be a file of type: :values.',
86 | 'mimetypes' => 'The :attribute must be a file of type: :values.',
87 | 'min' => [
88 | 'numeric' => 'The :attribute must be at least :min.',
89 | 'file' => 'The :attribute must be at least :min kilobytes.',
90 | 'string' => 'The :attribute must be at least :min characters.',
91 | 'array' => 'The :attribute must have at least :min items.',
92 | ],
93 | 'multiple_of' => 'The :attribute must be a multiple of :value',
94 | 'not_in' => 'The selected :attribute is invalid.',
95 | 'not_regex' => 'The :attribute format is invalid.',
96 | 'numeric' => 'The :attribute must be a number.',
97 | 'password' => 'The password is incorrect.',
98 | 'present' => 'The :attribute field must be present.',
99 | 'regex' => 'The :attribute format is invalid.',
100 | 'required' => 'The :attribute field is required.',
101 | 'required_if' => 'The :attribute field is required when :other is :value.',
102 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
103 | 'required_with' => 'The :attribute field is required when :values is present.',
104 | 'required_with_all' => 'The :attribute field is required when :values are present.',
105 | 'required_without' => 'The :attribute field is required when :values is not present.',
106 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
107 | 'same' => 'The :attribute and :other must match.',
108 | 'size' => [
109 | 'numeric' => 'The :attribute must be :size.',
110 | 'file' => 'The :attribute must be :size kilobytes.',
111 | 'string' => 'The :attribute must be :size characters.',
112 | 'array' => 'The :attribute must contain :size items.',
113 | ],
114 | 'starts_with' => 'The :attribute must start with one of the following: :values.',
115 | 'string' => 'The :attribute must be a string.',
116 | 'timezone' => 'The :attribute must be a valid zone.',
117 | 'unique' => 'The :attribute has already been taken.',
118 | 'uploaded' => 'The :attribute failed to upload.',
119 | 'url' => 'The :attribute format is invalid.',
120 | 'uuid' => 'The :attribute must be a valid UUID.',
121 |
122 | /*
123 | |--------------------------------------------------------------------------
124 | | Custom Validation Language Lines
125 | |--------------------------------------------------------------------------
126 | |
127 | | Here you may specify custom validation messages for attributes using the
128 | | convention "attribute.rule" to name the lines. This makes it quick to
129 | | specify a specific custom language line for a given attribute rule.
130 | |
131 | */
132 |
133 | 'custom' => [
134 | 'attribute-name' => [
135 | 'rule-name' => 'custom-message',
136 | ],
137 | ],
138 |
139 | /*
140 | |--------------------------------------------------------------------------
141 | | Custom Validation Attributes
142 | |--------------------------------------------------------------------------
143 | |
144 | | The following language lines are used to swap our attribute placeholder
145 | | with something more reader friendly such as "E-Mail Address" instead
146 | | of "email". This simply helps us make our message more expressive.
147 | |
148 | */
149 |
150 | 'attributes' => [],
151 |
152 | ];
153 |
--------------------------------------------------------------------------------
/resources/lang/en/verification.php:
--------------------------------------------------------------------------------
1 | 'Your email has been verified!',
6 | 'invalid' => 'The verification link is invalid.',
7 | 'already_verified' => 'The email is already verified.',
8 | 'user' => 'We can\'t find a user with that e-mail address.',
9 | 'sent' => 'We have e-mailed your verification link!',
10 |
11 | ];
12 |
--------------------------------------------------------------------------------
/resources/lang/es/auth.php:
--------------------------------------------------------------------------------
1 | 'Estas credenciales no coinciden con nuestros registros.',
17 | 'throttle' => 'Demasiados intentos de acceso. Por favor intente nuevamente en :seconds segundos.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/es/pagination.php:
--------------------------------------------------------------------------------
1 | '« Anterior',
17 | 'next' => 'Siguiente »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/es/passwords.php:
--------------------------------------------------------------------------------
1 | 'Las contraseñas deben coincidir y contener al menos 6 caracteres',
17 | 'reset' => '¡Tu contraseña ha sido restablecida!',
18 | 'sent' => '¡Te hemos enviado por correo el enlace para restablecer tu contraseña!',
19 | 'token' => 'El token de recuperación de contraseña es inválido.',
20 | 'user' => 'No podemos encontrar ningún usuario con ese correo electrónico.',
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/resources/lang/es/validation.php:
--------------------------------------------------------------------------------
1 | ':attribute debe ser aceptado.',
17 | 'active_url' => ':attribute no es una URL válida.',
18 | 'after' => ':attribute debe ser una fecha posterior a :date.',
19 | 'after_or_equal' => ':attribute debe ser una fecha posterior o igual a :date.',
20 | 'alpha' => ':attribute sólo debe contener letras.',
21 | 'alpha_dash' => ':attribute sólo debe contener letras, números y guiones.',
22 | 'alpha_num' => ':attribute sólo debe contener letras y números.',
23 | 'array' => ':attribute debe ser un conjunto.',
24 | 'before' => ':attribute debe ser una fecha anterior a :date.',
25 | 'before_or_equal' => ':attribute debe ser una fecha anterior o igual a :date.',
26 | 'between' => [
27 | 'numeric' => ':attribute tiene que estar entre :min - :max.',
28 | 'file' => ':attribute debe pesar entre :min - :max kilobytes.',
29 | 'string' => ':attribute tiene que tener entre :min - :max caracteres.',
30 | 'array' => ':attribute tiene que tener entre :min - :max ítems.',
31 | ],
32 | 'boolean' => 'El campo :attribute debe tener un valor verdadero o falso.',
33 | 'confirmed' => 'La confirmación de :attribute no coincide.',
34 | 'date' => ':attribute no es una fecha válida.',
35 | 'date_format' => ':attribute no corresponde al formato :format.',
36 | 'different' => ':attribute y :other deben ser diferentes.',
37 | 'digits' => ':attribute debe tener :digits dígitos.',
38 | 'digits_between' => ':attribute debe tener entre :min y :max dígitos.',
39 | 'dimensions' => 'Las dimensiones de la imagen :attribute no son válidas.',
40 | 'distinct' => 'El campo :attribute contiene un valor duplicado.',
41 | 'email' => ':attribute no es un correo válido',
42 | 'exists' => ':attribute es inválido.',
43 | 'file' => 'El campo :attribute debe ser un archivo.',
44 | 'filled' => 'El campo :attribute es obligatorio.',
45 | 'image' => ':attribute debe ser una imagen.',
46 | 'in' => ':attribute es inválido.',
47 | 'in_array' => 'El campo :attribute no existe en :other.',
48 | 'integer' => ':attribute debe ser un número entero.',
49 | 'ip' => ':attribute debe ser una dirección IP válida.',
50 | 'ipv4' => ':attribute debe ser un dirección IPv4 válida',
51 | 'ipv6' => ':attribute debe ser un dirección IPv6 válida.',
52 | 'json' => 'El campo :attribute debe tener una cadena JSON válida.',
53 | 'max' => [
54 | 'numeric' => ':attribute no debe ser mayor a :max.',
55 | 'file' => ':attribute no debe ser mayor que :max kilobytes.',
56 | 'string' => ':attribute no debe ser mayor que :max caracteres.',
57 | 'array' => ':attribute no debe tener más de :max elementos.',
58 | ],
59 | 'mimes' => ':attribute debe ser un archivo con formato: :values.',
60 | 'mimetypes' => ':attribute debe ser un archivo con formato: :values.',
61 | 'min' => [
62 | 'numeric' => 'El tamaño de :attribute debe ser de al menos :min.',
63 | 'file' => 'El tamaño de :attribute debe ser de al menos :min kilobytes.',
64 | 'string' => ':attribute debe contener al menos :min caracteres.',
65 | 'array' => ':attribute debe tener al menos :min elementos.',
66 | ],
67 | 'not_in' => ':attribute es inválido.',
68 | 'numeric' => ':attribute debe ser numérico.',
69 | 'present' => 'El campo :attribute debe estar presente.',
70 | 'regex' => 'El formato de :attribute es inválido.',
71 | 'required' => 'El campo :attribute es obligatorio.',
72 | 'required_if' => 'El campo :attribute es obligatorio cuando :other es :value.',
73 | 'required_unless' => 'El campo :attribute es obligatorio a menos que :other esté en :values.',
74 | 'required_with' => 'El campo :attribute es obligatorio cuando :values está presente.',
75 | 'required_with_all' => 'El campo :attribute es obligatorio cuando :values está presente.',
76 | 'required_without' => 'El campo :attribute es obligatorio cuando :values no está presente.',
77 | 'required_without_all' => 'El campo :attribute es obligatorio cuando ninguno de :values estén presentes.',
78 | 'same' => ':attribute y :other deben coincidir.',
79 | 'size' => [
80 | 'numeric' => 'El tamaño de :attribute debe ser :size.',
81 | 'file' => 'El tamaño de :attribute debe ser :size kilobytes.',
82 | 'string' => ':attribute debe contener :size caracteres.',
83 | 'array' => ':attribute debe contener :size elementos.',
84 | ],
85 | 'string' => 'El campo :attribute debe ser una cadena de caracteres.',
86 | 'timezone' => 'El :attribute debe ser una zona válida.',
87 | 'unique' => ':attribute ya ha sido registrado.',
88 | 'uploaded' => 'Subir :attribute ha fallado.',
89 | 'url' => 'El formato :attribute es inválido.',
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Custom Validation Language Lines
94 | |--------------------------------------------------------------------------
95 | |
96 | | Here you may specify custom validation messages for attributes using the
97 | | convention "attribute.rule" to name the lines. This makes it quick to
98 | | specify a specific custom language line for a given attribute rule.
99 | |
100 | */
101 |
102 | 'custom' => [
103 | 'password' => [
104 | 'min' => 'La :attribute debe contener más de :min caracteres',
105 | ],
106 | 'email' => [
107 | 'unique' => 'El :attribute ya ha sido registrado.',
108 | ],
109 | ],
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Custom Validation Attributes
114 | |--------------------------------------------------------------------------
115 | |
116 | | The following language lines are used to swap attribute place-holders
117 | | with something more reader friendly such as E-Mail Address instead
118 | | of "email". This simply helps us make messages a little cleaner.
119 | |
120 | */
121 |
122 | 'attributes' => [
123 | 'name' => 'nombre',
124 | 'username' => 'usuario',
125 | 'email' => 'correo electrónico',
126 | 'first_name' => 'nombre',
127 | 'last_name' => 'apellido',
128 | 'password' => 'contraseña',
129 | 'password_confirmation' => 'confirmación de la contraseña',
130 | 'city' => 'ciudad',
131 | 'country' => 'país',
132 | 'address' => 'dirección',
133 | 'phone' => 'teléfono',
134 | 'mobile' => 'móvil',
135 | 'age' => 'edad',
136 | 'sex' => 'sexo',
137 | 'gender' => 'género',
138 | 'year' => 'año',
139 | 'month' => 'mes',
140 | 'day' => 'día',
141 | 'hour' => 'hora',
142 | 'minute' => 'minuto',
143 | 'second' => 'segundo',
144 | 'title' => 'título',
145 | 'content' => 'contenido',
146 | 'body' => 'contenido',
147 | 'description' => 'descripción',
148 | 'excerpt' => 'extracto',
149 | 'date' => 'fecha',
150 | 'time' => 'hora',
151 | 'subject' => 'asunto',
152 | 'message' => 'mensaje',
153 | ],
154 |
155 | ];
156 |
--------------------------------------------------------------------------------
/resources/lang/zh-CN/auth.php:
--------------------------------------------------------------------------------
1 | '用户名或手机号与密码不匹配或用户被禁用',
15 | 'throttle' => '失败次数太多,请在:seconds秒后再尝试',
16 | ];
17 |
--------------------------------------------------------------------------------
/resources/lang/zh-CN/pagination.php:
--------------------------------------------------------------------------------
1 | '« 上一页',
15 | 'next' => '下一页 »',
16 | ];
17 |
--------------------------------------------------------------------------------
/resources/lang/zh-CN/passwords.php:
--------------------------------------------------------------------------------
1 | '密码长度至少包含6个字符并且两次输入密码要一致',
15 | 'reset' => '密码已经被重置!',
16 | 'sent' => '我们已经发送密码重置链接到您的邮箱',
17 | 'token' => '密码重置令牌无效',
18 | 'user' => '抱歉,该邮箱对应的用户不存在!',
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/zh-CN/validation.php:
--------------------------------------------------------------------------------
1 | ':attribute 已存在',
15 | 'accepted' => ':attribute 是被接受的',
16 | 'active_url' => ':attribute 必须是一个合法的 URL',
17 | 'after' => ':attribute 必须是 :date 之后的一个日期',
18 | 'alpha' => ':attribute 必须全部由字母字符构成。',
19 | 'alpha_dash' => ':attribute 必须全部由字母、数字、中划线或下划线字符构成',
20 | 'alpha_num' => ':attribute 必须全部由字母和数字构成',
21 | 'array' => ':attribute 必须是个数组',
22 | 'before' => ':attribute 必须是 :date 之前的一个日期',
23 | 'between' => [
24 | 'numeric' => ':attribute 必须在 :min 到 :max 之间',
25 | 'file' => ':attribute 必须在 :min 到 :max KB之间',
26 | 'string' => ':attribute 必须在 :min 到 :max 个字符之间',
27 | 'array' => ':attribute 必须在 :min 到 :max 项之间',
28 | ],
29 | 'boolean' => ':attribute 字符必须是 true 或 false',
30 | 'confirmed' => ':attribute 两次确认不匹配',
31 | 'date' => ':attribute 必须是一个合法的日期',
32 | 'date_format' => ':attribute 与给定的格式 :format 不符合',
33 | 'different' => ':attribute 必须不同于:other',
34 | 'digits' => ':attribute 必须是 :digits 位',
35 | 'digits_between' => ':attribute 必须在 :min and :max 位之间',
36 | 'email' => ':attribute 必须是一个合法的电子邮件地址。',
37 | 'filled' => ':attribute 的字段是必填的',
38 | 'exists' => '选定的 :attribute 是无效的',
39 | 'image' => ':attribute 必须是一个图片 (jpeg, png, bmp 或者 gif)',
40 | 'in' => '选定的 :attribute 是无效的',
41 | 'integer' => ':attribute 必须是个整数',
42 | 'ip' => ':attribute 必须是一个合法的 IP 地址。',
43 | 'max' => [
44 | 'numeric' => ':attribute 的最大长度为 :max 位',
45 | 'file' => ':attribute 的最大为 :max',
46 | 'string' => ':attribute 的最大长度为 :max 字符',
47 | 'array' => ':attribute 的最大个数为 :max 个',
48 | ],
49 | 'mimes' => ':attribute 的文件类型必须是:values',
50 | 'mimetypes' => ':attribute 的文件类型必须是: :values.',
51 | 'min' => [
52 | 'numeric' => ':attribute 的最小长度为 :min 位',
53 | 'string' => ':attribute 的最小长度为 :min 字符',
54 | 'file' => ':attribute 大小至少为:min KB',
55 | 'array' => ':attribute 至少有 :min 项',
56 | ],
57 | 'not_in' => '选定的 :attribute 是无效的',
58 | 'numeric' => ':attribute 必须是数字',
59 | 'regex' => ':attribute 格式是无效的',
60 | 'required' => ':attribute 字段必须填写',
61 | 'required_if' => ':attribute 字段是必须的当 :other 是 :value',
62 | 'required_with' => ':attribute 字段是必须的当 :values 是存在的',
63 | 'required_with_all' => ':attribute 字段是必须的当 :values 是存在的',
64 | 'required_without' => ':attribute 字段是必须的当 :values 是不存在的',
65 | 'required_without_all' => ':attribute 字段是必须的当 没有一个 :values 是存在的',
66 | 'same' => ':attribute 和 :other 必须匹配',
67 | 'size' => [
68 | 'numeric' => ':attribute 必须是 :size 位',
69 | 'file' => ':attribute 必须是 :size KB',
70 | 'string' => ':attribute 必须是 :size 个字符',
71 | 'array' => ':attribute 必须包括 :size 项',
72 | ],
73 | 'url' => ':attribute 无效的格式',
74 | 'timezone' => ':attribute 必须个有效的时区',
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Custom Validation Language Lines
78 | |--------------------------------------------------------------------------
79 | |
80 | | Here you may specify custom validation messages for attributes using the
81 | | convention "attribute.rule" to name the lines. This makes it quick to
82 | | specify a specific custom language line for a given attribute rule.
83 | |
84 | */
85 | 'custom' => [],
86 | /*
87 | |--------------------------------------------------------------------------
88 | | Custom Validation Attributes
89 | |--------------------------------------------------------------------------
90 | |
91 | | The following language lines are used to swap attribute place-holders
92 | | with something more reader friendly such as E-Mail Address instead
93 | | of "email". This simply helps us make messages a little cleaner.
94 | |
95 | */
96 | 'attributes' => [],
97 | ];
98 |
--------------------------------------------------------------------------------
/resources/views/errors/layout.blade.php:
--------------------------------------------------------------------------------
1 | {{-- Illuminate/Foundation/Exceptions/views --}}
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | @yield('title')
10 |
11 |
12 |
13 |
14 |
15 |
48 |
49 |
50 |
51 |
52 |
53 | @yield('message')
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/resources/views/oauth/callback.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ config('app.name') }}
5 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/resources/views/oauth/emailTaken.blade.php:
--------------------------------------------------------------------------------
1 | @extends('errors.layout')
2 |
3 | @section('title', 'Login Error')
4 |
5 | @section('message', 'Email already taken.')
6 |
--------------------------------------------------------------------------------
/routes/api.php:
--------------------------------------------------------------------------------
1 | 'auth:api'], function () {
26 | Route::post('logout', [LoginController::class, 'logout']);
27 |
28 | Route::get('user', [UserController::class, 'current']);
29 |
30 | Route::patch('settings/profile', [ProfileController::class, 'update']);
31 | Route::patch('settings/password', [PasswordController::class, 'update']);
32 | });
33 |
34 | Route::group(['middleware' => 'guest:api'], function () {
35 | Route::post('login', [LoginController::class, 'login']);
36 | Route::post('register', [RegisterController::class, 'register']);
37 |
38 | Route::post('password/email', [ForgotPasswordController::class, 'sendResetLinkEmail']);
39 | Route::post('password/reset', [ResetPasswordController::class, 'reset']);
40 |
41 | Route::post('email/verify/{user}', [VerificationController::class, 'verify'])->name('verification.verify');
42 | Route::post('email/resend', [VerificationController::class, 'resend']);
43 |
44 | Route::post('oauth/{driver}', [OAuthController::class, 'redirect']);
45 | Route::get('oauth/{driver}/callback', [OAuthController::class, 'handleCallback'])->name('oauth.callback');
46 | });
47 |
--------------------------------------------------------------------------------
/routes/channels.php:
--------------------------------------------------------------------------------
1 | id === (int) $id;
18 | });
19 |
--------------------------------------------------------------------------------
/routes/console.php:
--------------------------------------------------------------------------------
1 | comment(Inspiring::quote());
19 | })->purpose('Display an inspiring quote');
20 |
--------------------------------------------------------------------------------
/routes/spa.php:
--------------------------------------------------------------------------------
1 | where('path', '(.*)');
18 |
--------------------------------------------------------------------------------
/routes/web.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $uri = urldecode(
9 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
10 | );
11 |
12 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
13 | // built-in PHP web server. This provides a convenient way to test a Laravel
14 | // application without having installed a "real" web server software here.
15 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
16 | return false;
17 | }
18 |
19 | require_once __DIR__.'/public/index.php';
20 |
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | compiled.php
2 | config.php
3 | down
4 | events.scanned.php
5 | maintenance.php
6 | routes.php
7 | routes.scanned.php
8 | schedule-*
9 | services.json
10 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !data/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/testing/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
19 |
20 | return $app;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/Feature/LocaleTest.php:
--------------------------------------------------------------------------------
1 | withHeaders(['Accept-Language' => 'zh-CN'])
13 | ->postJson('/api/login');
14 |
15 | $this->assertEquals('zh-CN', $this->app->getLocale());
16 | }
17 |
18 | /** @test */
19 | public function set_locale_from_header_short()
20 | {
21 | $this->withHeaders(['Accept-Language' => 'en-US'])
22 | ->postJson('/api/login');
23 |
24 | $this->assertEquals('en', $this->app->getLocale());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/Feature/LoginTest.php:
--------------------------------------------------------------------------------
1 | create();
14 |
15 | $this->postJson('/api/login', [
16 | 'email' => $user->email,
17 | 'password' => 'password',
18 | ])
19 | ->assertSuccessful()
20 | ->assertJsonStructure(['token', 'expires_in'])
21 | ->assertJson(['token_type' => 'bearer']);
22 | }
23 |
24 | /** @test */
25 | public function fetch_the_current_user()
26 | {
27 | $this->actingAs(User::factory()->create())
28 | ->getJson('/api/user')
29 | ->assertSuccessful()
30 | ->assertJsonStructure(['id', 'name', 'email']);
31 | }
32 |
33 | /** @test */
34 | public function log_out()
35 | {
36 | $token = $this->postJson('/api/login', [
37 | 'email' => User::factory()->create()->email,
38 | 'password' => 'password',
39 | ])->json()['token'];
40 |
41 | $this->postJson("/api/logout?token=$token")
42 | ->assertSuccessful();
43 |
44 | $this->getJson("/api/user?token=$token")
45 | ->assertStatus(401);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/tests/Feature/OAuthTest.php:
--------------------------------------------------------------------------------
1 | getContent(), $text), "Expected text [{$text}] not found.");
22 |
23 | return $this;
24 | });
25 |
26 | TestResponse::macro('assertTextMissing', function ($text) {
27 | PHPUnit::assertFalse(Str::contains($this->getContent(), $text), "Expected missing text [{$text}] found.");
28 |
29 | return $this;
30 | });
31 | }
32 |
33 | /** @test */
34 | public function redirect_to_provider()
35 | {
36 | $this->mockSocialite('github');
37 |
38 | $this->postJson('/api/oauth/github')
39 | ->assertSuccessful()
40 | ->assertJson(['url' => 'https://url-to-provider']);
41 | }
42 |
43 | /** @test */
44 | public function create_user_and_return_token()
45 | {
46 | $this->mockSocialite('github', [
47 | 'id' => '123',
48 | 'name' => 'Test User',
49 | 'email' => 'test@example.com',
50 | 'token' => 'access-token',
51 | 'refreshToken' => 'refresh-token',
52 | ]);
53 |
54 | $this->withoutExceptionHandling();
55 |
56 | $this->get('/api/oauth/github/callback')
57 | ->assertText('token')
58 | ->assertSuccessful();
59 |
60 | $this->assertDatabaseHas('users', [
61 | 'name' => 'Test User',
62 | 'email' => 'test@example.com',
63 | ]);
64 |
65 | $this->assertDatabaseHas('oauth_providers', [
66 | 'user_id' => User::first()->id,
67 | 'provider' => 'github',
68 | 'provider_user_id' => '123',
69 | 'access_token' => 'access-token',
70 | 'refresh_token' => 'refresh-token',
71 | ]);
72 | }
73 |
74 | /** @test */
75 | public function update_user_and_return_token()
76 | {
77 | $user = User::factory()->create(['email' => 'test@example.com']);
78 | $user->oauthProviders()->create([
79 | 'provider' => 'github',
80 | 'provider_user_id' => '123',
81 | ]);
82 |
83 | $this->mockSocialite('github', [
84 | 'id' => '123',
85 | 'email' => 'test@example.com',
86 | 'token' => 'updated-access-token',
87 | 'refreshToken' => 'updated-refresh-token',
88 | ]);
89 |
90 | $this->get('/api/oauth/github/callback')
91 | ->assertText('token')
92 | ->assertSuccessful();
93 |
94 | $this->assertDatabaseHas('oauth_providers', [
95 | 'user_id' => $user->id,
96 | 'access_token' => 'updated-access-token',
97 | 'refresh_token' => 'updated-refresh-token',
98 | ]);
99 | }
100 |
101 | /** @test */
102 | public function can_not_create_user_if_email_is_taken()
103 | {
104 | User::factory()->create(['email' => 'test@example.com']);
105 |
106 | $this->mockSocialite('github', ['email' => 'test@example.com']);
107 |
108 | $this->get('/api/oauth/github/callback')
109 | ->assertText('Email already taken.')
110 | ->assertTextMissing('token')
111 | ->assertStatus(400);
112 | }
113 |
114 | protected function mockSocialite($provider, $user = null)
115 | {
116 | $mock = Socialite::shouldReceive('stateless')
117 | ->andReturn(m::self())
118 | ->shouldReceive('driver')
119 | ->with($provider)
120 | ->andReturn(m::self());
121 |
122 | if ($user) {
123 | $mock->shouldReceive('user')
124 | ->andReturn((new SocialiteUser)->setRaw($user)->map($user));
125 | } else {
126 | $mock->shouldReceive('redirect')
127 | ->andReturn(redirect('https://url-to-provider'));
128 | }
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/tests/Feature/RegisterTest.php:
--------------------------------------------------------------------------------
1 | postJson('/api/register', [
14 | 'name' => 'Test User',
15 | 'email' => 'test@test.app',
16 | 'password' => 'secret',
17 | 'password_confirmation' => 'secret',
18 | ])
19 | ->assertSuccessful()
20 | ->assertJsonStructure(['id', 'name', 'email']);
21 | }
22 |
23 | /** @test */
24 | public function can_not_register_with_existing_email()
25 | {
26 | User::factory()->create(['email' => 'test@test.app']);
27 |
28 | $this->postJson('/api/register', [
29 | 'name' => 'Test User',
30 | 'email' => 'test@test.app',
31 | 'password' => 'secret',
32 | 'password_confirmation' => 'secret',
33 | ])
34 | ->assertStatus(422)
35 | ->assertJsonValidationErrors(['email']);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tests/Feature/SettingsTest.php:
--------------------------------------------------------------------------------
1 | actingAs($user = User::factory()->create())
15 | ->patchJson('/api/settings/profile', [
16 | 'name' => 'Test User',
17 | 'email' => 'test@test.app',
18 | ])
19 | ->assertSuccessful()
20 | ->assertJsonStructure(['id', 'name', 'email']);
21 |
22 | $this->assertDatabaseHas('users', [
23 | 'id' => $user->id,
24 | 'name' => 'Test User',
25 | 'email' => 'test@test.app',
26 | ]);
27 | }
28 |
29 | /** @test */
30 | public function update_password()
31 | {
32 | $this->actingAs($user = User::factory()->create())
33 | ->patchJson('/api/settings/password', [
34 | 'password' => 'updated',
35 | 'password_confirmation' => 'updated',
36 | ])
37 | ->assertSuccessful();
38 |
39 | $this->assertTrue(Hash::check('updated', $user->password));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/Feature/VerificationTest.php:
--------------------------------------------------------------------------------
1 | create(['email_verified_at' => null]);
19 | $url = URL::temporarySignedRoute('verification.verify', now()->addMinutes(60), ['user' => $user->id]);
20 |
21 | Event::fake();
22 |
23 | $this->postJson($url)
24 | ->assertSuccessful()
25 | ->assertJsonFragment(['status' => 'Your email has been verified!']);
26 |
27 | Event::assertDispatched(Verified::class, function (Verified $e) use ($user) {
28 | return $e->user->is($user);
29 | });
30 | }
31 |
32 | /** @test */
33 | public function can_not_verify_if_already_verified()
34 | {
35 | $user = User::factory()->create();
36 | $url = URL::temporarySignedRoute('verification.verify', now()->addMinutes(60), ['user' => $user->id]);
37 |
38 | $this->postJson($url)
39 | ->assertStatus(400)
40 | ->assertJsonFragment(['status' => 'The email is already verified.']);
41 | }
42 |
43 | /** @test */
44 | public function can_not_verify_if_url_has_invalid_signature()
45 | {
46 | $user = User::factory()->create(['email_verified_at' => null]);
47 |
48 | $this->postJson("/api/email/verify/{$user->id}")
49 | ->assertStatus(400)
50 | ->assertJsonFragment(['status' => 'The verification link is invalid.']);
51 | }
52 |
53 | /** @test */
54 | public function resend_verification_notification()
55 | {
56 | $user = User::factory()->create(['email_verified_at' => null]);
57 |
58 | Notification::fake();
59 |
60 | $this->postJson('/api/email/resend', ['email' => $user->email])
61 | ->assertSuccessful();
62 |
63 | Notification::assertSentTo($user, VerifyEmail::class);
64 | }
65 |
66 | /** @test */
67 | public function can_not_resend_verification_notification_if_email_does_not_exist()
68 | {
69 | $this->postJson('/api/email/resend', ['email' => 'foo@bar.com'])
70 | ->assertStatus(422)
71 | ->assertJsonFragment(['errors' => ['email' => ['We can\'t find a user with that e-mail address.']]]);
72 | }
73 |
74 | /** @test */
75 | public function can_not_resend_verification_notification_if_email_already_verified()
76 | {
77 | $user = User::factory()->create();
78 |
79 | Notification::fake();
80 |
81 | $this->postJson('/api/email/resend', ['email' => $user->email])
82 | ->assertStatus(422)
83 | ->assertJsonFragment(['errors' => ['email' => ['The email is already verified.']]]);
84 |
85 | Notification::assertNotSentTo($user, VerifyEmail::class);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------