├── .editorconfig ├── .env.example ├── .eslintrc.js ├── .gitattributes ├── .github └── workflows │ ├── laravel-unit-testing.yml │ └── php-cs-fixer.yml ├── .gitignore ├── .php-cs-fixer.dist.php ├── .styleci.yml ├── LICENSE ├── README.md ├── app ├── Console │ ├── Commands │ │ ├── MakeBackEndModule.php │ │ ├── MakeFrontEndModule.php │ │ └── MakeModuleCommand.php │ └── Kernel.php ├── Contracts │ └── RepositoryInterface.php ├── Exceptions │ ├── Handler.php │ └── VerifyEmailException.php ├── Http │ ├── Controllers │ │ └── Controller.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php ├── Models │ ├── PersonalAccessToken.php │ └── User.php ├── Modules │ ├── Auth │ │ ├── Controllers │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── RegisterController.php │ │ │ ├── ResetPasswordController.php │ │ │ ├── UserController.php │ │ │ └── VerificationController.php │ │ └── routes_api.php │ └── Setting │ │ ├── Controllers │ │ └── ProfileController.php │ │ ├── Requests │ │ └── ProfileRequest.php │ │ └── routes_api.php ├── Notifications │ ├── ResetPassword.php │ └── VerifyEmail.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php └── Repositories │ ├── AbstractRepository.php │ └── UserRepository.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── database.php ├── filesystems.php ├── hashing.php ├── jwt.php ├── logging.php ├── mail.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ └── 2019_12_14_000001_create_personal_access_tokens_table.php └── seeders │ └── DatabaseSeeder.php ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── favicon.ico ├── index.php ├── preview.png └── robots.txt ├── resources ├── js │ ├── app.js │ ├── bootstrap │ │ ├── auth.js │ │ ├── day.js │ │ ├── i18n.js │ │ └── router.js │ ├── core │ │ ├── App.vue │ │ ├── components │ │ │ ├── Breadcrumbs.vue │ │ │ ├── Home.vue │ │ │ ├── Index.vue │ │ │ ├── Navbar.vue │ │ │ ├── NotFound.vue │ │ │ ├── Sidebar.vue │ │ │ └── Welcome.vue │ │ ├── constants │ │ │ └── time.constants.js │ │ ├── routes.js │ │ └── store │ │ │ ├── index.js │ │ │ ├── store.js │ │ │ └── types.js │ ├── includes │ │ ├── Errors.js │ │ ├── lang │ │ │ ├── en.js │ │ │ ├── index.js │ │ │ └── ru.js │ │ └── mixins │ │ │ └── globalMixin.js │ └── modules │ │ ├── auth │ │ ├── api │ │ │ └── index.js │ │ ├── components │ │ │ ├── Login.vue │ │ │ ├── LoginForm.vue │ │ │ ├── Register.vue │ │ │ ├── RegisterForm.vue │ │ │ ├── ResendVerification.vue │ │ │ └── VerifyEmail.vue │ │ ├── routes_auth.js │ │ └── store │ │ │ ├── store.js │ │ │ └── types.js │ │ ├── dashboard │ │ ├── components │ │ │ └── Dashboard.vue │ │ └── routes.js │ │ ├── notification │ │ ├── components │ │ │ └── notificationMixin.js │ │ └── store │ │ │ ├── store.js │ │ │ └── types.js │ │ └── setting │ │ ├── api │ │ └── index.js │ │ ├── components │ │ ├── Profile.vue │ │ └── ProfileForm.vue │ │ └── routes.js ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ ├── validation.php │ │ └── verification.php ├── sass │ ├── _transitions.scss │ ├── _variables.scss │ ├── app.scss │ └── style.scss └── views │ └── spa.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── stubs ├── backEnd │ ├── controller.api.stub │ ├── request.stub │ ├── resource.stub │ └── routes.api.stub ├── factory.stub ├── frontEnd │ ├── api.stub │ ├── routes.stub │ ├── store.actions.stub │ ├── store.stub │ ├── store.types.stub │ ├── vue.form.stub │ ├── vue.list.stub │ └── vue.view.stub ├── migration.create.stub ├── model.stub └── test.stub ├── tests ├── CreatesApplication.php ├── Feature │ ├── LoginTest.php │ ├── RegisterTest.php │ ├── SettingsTest.php │ └── VerificationTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php ├── webpack.config.js ├── webpack.mix.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME="Laravel Vue SPA Skeleton" 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://127.0.0.1:8000 6 | 7 | MIX_API_ENDPOINT=http://127.0.0.1:8000/api/v1/ 8 | 9 | LOG_CHANNEL=stack 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=mysql 13 | DB_PORT=3306 14 | DB_DATABASE=skeleton 15 | DB_USERNAME=root 16 | DB_PASSWORD=root 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | QUEUE_CONNECTION=sync 21 | SESSION_DRIVER=file 22 | SESSION_LIFETIME=120 23 | 24 | SESSION_DOMAIN=localhost 25 | SANCTUM_STATEFUL_DOMAINS=localhost 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_DRIVER=smtp 32 | MAIL_HOST=smtp.mailtrap.io 33 | MAIL_PORT=2525 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS=null 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | 45 | PUSHER_APP_ID= 46 | PUSHER_APP_KEY= 47 | PUSHER_APP_SECRET= 48 | PUSHER_APP_CLUSTER=mt1 49 | 50 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 51 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 52 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | 'plugin:vue/recommended', 4 | ], 5 | rules: { 6 | 'indent': [ 7 | 'warn', 8 | 4 9 | ], 10 | 'vue/html-indent': [ 11 | 'warn', 12 | 4 13 | ], 14 | 'jsx-quotes': [ 15 | 'error', 16 | 'prefer-double' 17 | ], 18 | 'linebreak-style': [ 19 | 'error', 20 | 'unix' 21 | ], 22 | 'quotes': [ 23 | 'warn', 24 | 'single' 25 | ], 26 | 'semi': [ 27 | 'warn', 28 | 'never' 29 | ], 30 | 'vue/sort-keys': 'off', 31 | 'vue/static-class-names-order': 'off', 32 | 'vue/order-in-components': 'off', 33 | 'vue/no-v-html': 'off', 34 | 'vue/require-valid-default-prop': 'off' 35 | }, 36 | 'parserOptions': { 37 | 'parser': 'babel-eslint', 38 | 'ecmaVersion': 2020, 39 | 'sourceType': 'module', 40 | 'allowImportExportEverywhere': true 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.github/workflows/laravel-unit-testing.yml: -------------------------------------------------------------------------------- 1 | name: Laravel 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | 7 | jobs: 8 | laravel-tests: 9 | 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: nanasess/setup-php@master 15 | with: 16 | php-version: '8.0' 17 | - name: Copy .env 18 | run: php -r "file_exists('.env') || copy('.env.example', '.env');" 19 | - name: Install Dependencies 20 | run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist 21 | - name: Generate key 22 | run: php artisan key:generate 23 | - name: Directory Permissions 24 | run: chmod -R 777 storage bootstrap/cache 25 | - name: Create Database 26 | run: | 27 | mkdir -p database 28 | touch database/database.sqlite 29 | - name: Execute tests (Unit and Feature tests) via PHPUnit 30 | env: 31 | DB_CONNECTION: sqlite 32 | DB_DATABASE: database/database.sqlite 33 | run: vendor/bin/phpunit 34 | -------------------------------------------------------------------------------- /.github/workflows/php-cs-fixer.yml: -------------------------------------------------------------------------------- 1 | name: Check & fix styling 2 | 3 | on: [push] 4 | 5 | jobs: 6 | php-cs-fixer: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v2 12 | with: 13 | ref: ${{ github.head_ref }} 14 | 15 | - name: Install Dependencies 16 | run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist 17 | 18 | - name: Run PHP CS Fixer 19 | uses: docker://oskarstark/php-cs-fixer-ga 20 | with: 21 | args: --config=.php-cs-fixer.dist.php 22 | 23 | - name: Commit changes 24 | uses: stefanzweifel/git-auto-commit-action@v4 25 | with: 26 | commit_message: Fix styling 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /public/js/ 5 | /public/css/ 6 | /public/fonts/ 7 | /public/mix-manifest.json 8 | /storage/*.key 9 | /vendor 10 | .env 11 | .env.backup 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | npm-debug.log 16 | yarn-error.log 17 | .idea 18 | .php-cs-fixer.cache 19 | -------------------------------------------------------------------------------- /.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | setFinder( 8 | PhpCsFixer\Finder::create() 9 | ->in(app_path()) 10 | ->in(config_path()) 11 | ->in(database_path('factories')) 12 | ->in(database_path('seeders')) 13 | ->in(resource_path('lang')) 14 | ->in(base_path('routes')) 15 | ->in(base_path('tests')) 16 | ) 17 | ->setRules([ 18 | '@Laravel' => true, 19 | ]); 20 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | disabled: 4 | - unused_use 5 | finder: 6 | not-name: 7 | - index.php 8 | - server.php 9 | js: 10 | finder: 11 | not-name: 12 | - webpack.mix.js 13 | css: true 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Yurich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Vue logo 4 | 5 |

6 | 7 | # I am currently working on a new [Laravel Vue 3 project](https://github.com/Yurich84/laravel-vue3-spa) with Composition Api, Vite and Pinia as store manager. 8 | 9 | [![MIT Licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) 10 | 11 | #### This is a basement for a large modular SPA, that utilises Laravel, Vue, ElementUI. 12 | #### CRUD generator is integrated in project creates standalone modules on the frontend and backend. 13 | 14 |

15 | 16 |

17 | 18 | The main goals of the project are: 19 | - to avoid hard cohesion between modules 20 | - to form the basis for writing clean code 21 | - to be easy to expand 22 | - to avoid code duplication 23 | - to reduce the start time of the project 24 | - to reduce the time of project support and code navigation 25 | - to be understandable for an inexperienced programmer 26 | 27 | ## Extensions 28 | 29 | - BackEnd: [Laravel 8](https://laravel.com/) 30 | - FrontEnd: [Vue](https://vuejs.org) + [VueRouter](https://router.vuejs.org) + [Vuex](https://vuex.vuejs.org) + [VueI18n](https://kazupon.github.io/vue-i18n/) 31 | - Login using [JWT](https://jwt.io/) with [Vue-Auth](https://websanova.com/docs/vue-auth/home), [Axios](https://github.com/mzabriskie/axios) and [Sanctum](https://laravel.com/docs/8.x/sanctum). 32 | - The api routes, are separate for each module, in **Modules/{ModuleName}/routes_api.php** 33 | - [ElementUI](http://element.eleme.io/) UI Kit 34 | - [Lodash](https://lodash.com) js utilities 35 | - [Moment](https://momentjs.com) time manipulations 36 | - [FontAwesome 5](http://fontawesome.io/icons/) icons 37 | 38 | ## Install 39 | - `git clone https://github.com/Yurich84/laravel-vue-spa-skeleton.git` 40 | - `cd laravel-vue-spa-skeleton` 41 | - `composer install` 42 | - `cp .env.example .env` - copy .env file 43 | - set your DB credentials in `.env` 44 | - `php artisan key:generate` 45 | - `php artisan migrate` 46 | - `yarn install` 47 | 48 | ## Testing 49 | 50 | ### Unit Testing 51 | `php artisan test` 52 | 53 | ## Usage 54 | - `npm run watch` or `npm run hot` - for hot reloading 55 | - `php artisan serve` and go [127.0.0.1:8000](http://127.0.0.1:8000) 56 | - Create new user and login. 57 | 58 | ### Creating module 59 | You can easily create module with CRUD functionality. 60 | 61 | `php artisan make:module {ModuleName}` 62 | 63 | This will create: 64 | 65 | - **migration** `database/migrations/000_00_00_000000_create_{ModuleName}_table.php` 66 | 67 | - **model** `app/Models/{ModuleName}.php` 68 | 69 | - **factory** `database/factories/{ModuleName}Factory.php` 70 | 71 | - **tests** `tests/Feature/{ModuleName}Test.php` 72 | 73 | - **backend module** `app/Modules/{ModuleName}/` 74 | ``` 75 | {ModuleName}/ 76 | │ 77 | ├── routes_api.php 78 | │ 79 | ├── Controllers/ 80 | │ └── {ModuleName}Controller.php 81 | │ 82 | ├── Requests/ 83 | │ └── {ModuleName}Request.php 84 | │ 85 | └── Resources/ 86 | └── {ModuleName}Resource.php 87 | ``` 88 | 89 | - **frontend module** `resources/js/modules/{moduleName}/` 90 | ``` 91 | {moduleName}/ 92 | │ 93 | ├── routes.js 94 | │ 95 | ├── api/ 96 | │ └── index.js 97 | │ 98 | ├── components/ 99 | │ ├── {ModuleName}List.vue 100 | │ ├── {ModuleName}View.vue 101 | │ └── {ModuleName}Form.vue 102 | │ 103 | └── store/ 104 | ├── store.js 105 | ├── types.js 106 | └── actions.js 107 | ``` 108 | 109 | 110 | > After creating module, you can edit model and migration by adding fields you need. 111 | > Also you can add this fields into view. 112 | > Don't forget run php artisan migrate. 113 | 114 | Every module loads dynamically. 115 | 116 | ## [Video](https://www.youtube.com/watch?v=0qKNlrmhgNg) 117 | -------------------------------------------------------------------------------- /app/Console/Commands/MakeBackEndModule.php: -------------------------------------------------------------------------------- 1 | output = new ConsoleOutput(); 18 | } 19 | 20 | /** 21 | * @var string 22 | */ 23 | private $module_path; 24 | 25 | /** 26 | * @param $module 27 | * @throws FileNotFoundException 28 | */ 29 | protected function create($module) { 30 | $this->files = new Filesystem(); 31 | $this->module = $module; 32 | $this->module_path = app_path('Modules/'.$this->module); 33 | 34 | $this->createController(); 35 | $this->createRoutes(); 36 | $this->createRequest(); 37 | $this->createResource(); 38 | } 39 | 40 | /** 41 | * Create a controller for the module. 42 | * 43 | * @return void 44 | * @throws FileNotFoundException 45 | */ 46 | private function createController() 47 | { 48 | $path = $this->module_path."/Controllers/{$this->module}Controller.php"; 49 | 50 | if ($this->alreadyExists($path)) { 51 | $this->error('Controller already exists!'); 52 | } else { 53 | $stub = $this->files->get(base_path('stubs/backEnd/controller.api.stub')); 54 | 55 | $this->createFileWithStub($stub, $path); 56 | 57 | $this->info('Controller created successfully.'); 58 | } 59 | } 60 | 61 | /** 62 | * Create a Routes for the module. 63 | * 64 | * @throws FileNotFoundException 65 | */ 66 | private function createRoutes() { 67 | $path = $this->module_path.'/routes_api.php'; 68 | 69 | if ($this->alreadyExists($path)) { 70 | $this->error('Routes already exists!'); 71 | } else { 72 | $stub = $this->files->get(base_path('stubs/backEnd/routes.api.stub')); 73 | 74 | $this->createFileWithStub($stub, $path); 75 | 76 | $this->info('Routes created successfully.'); 77 | } 78 | } 79 | 80 | /** 81 | * Create a Request for the module. 82 | * 83 | * @throws FileNotFoundException 84 | */ 85 | private function createRequest() 86 | { 87 | $path = $this->module_path."/Requests/{$this->module}Request.php"; 88 | 89 | if ($this->alreadyExists($path)) { 90 | $this->error('Request already exists!'); 91 | } else { 92 | $stub = $this->files->get(base_path('stubs/backEnd/request.stub')); 93 | 94 | $this->createFileWithStub($stub, $path); 95 | 96 | $this->info('Request created successfully.'); 97 | } 98 | } 99 | 100 | /** 101 | * Create a Resource for the module. 102 | * 103 | * @throws FileNotFoundException 104 | */ 105 | private function createResource() 106 | { 107 | $path = $this->module_path."/Resources/{$this->module}Resource.php"; 108 | 109 | if ($this->alreadyExists($path)) { 110 | $this->error('Resource already exists!'); 111 | } else { 112 | $stub = $this->files->get(base_path('stubs/backEnd/resource.stub')); 113 | 114 | $this->createFileWithStub($stub, $path); 115 | 116 | $this->info('Resource created successfully.'); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /app/Console/Commands/MakeModuleCommand.php: -------------------------------------------------------------------------------- 1 | files = $files; 59 | 60 | $this->module = Str::of(class_basename($this->argument('name')))->studly()->singular(); 61 | 62 | $this->createModel(); 63 | 64 | $this->createMigration(); 65 | 66 | $backEndModule->create($this->module); 67 | 68 | $frontEndModule->create($this->module); 69 | 70 | $this->createFactory(); 71 | 72 | $this->createTest(); 73 | 74 | } 75 | 76 | /** 77 | * Create a model file for the module. 78 | * 79 | * @return void 80 | */ 81 | protected function createModel() 82 | { 83 | $this->call('make:model', [ 84 | 'name' => $this->module, 85 | ]); 86 | } 87 | 88 | /** 89 | * Create a migration file for the module. 90 | * 91 | * @return void 92 | */ 93 | protected function createMigration() 94 | { 95 | $table = $this->module->plural()->snake(); 96 | 97 | try { 98 | $this->call('make:migration', [ 99 | 'name' => "create_{$table}_table", 100 | '--create' => $table, 101 | ]); 102 | } catch (Exception $e) { 103 | $this->error($e->getMessage()); 104 | } 105 | } 106 | 107 | /** 108 | * Create a factory file for the module. 109 | * 110 | * @return void 111 | */ 112 | protected function createFactory() 113 | { 114 | $this->call('make:factory', [ 115 | 'name' => $this->module.'Factory', 116 | '--model' => "$this->module", 117 | ]); 118 | } 119 | 120 | /** 121 | * Create a test file for the module. 122 | * 123 | * @return void 124 | * @throws FileNotFoundException 125 | */ 126 | protected function createTest() 127 | { 128 | $path = base_path('tests/Feature/'.$this->module.'Test.php'); 129 | 130 | if ($this->alreadyExists($path)) { 131 | $this->error('Test file already exists!'); 132 | } else { 133 | $stub = (new Filesystem)->get(base_path('stubs/test.stub')); 134 | 135 | $this->createFileWithStub($stub, $path); 136 | 137 | $this->info('Tests created successfully.'); 138 | } 139 | } 140 | 141 | /** 142 | * Determine if the class already exists. 143 | * 144 | * @param string $path 145 | * @return bool 146 | */ 147 | protected function alreadyExists($path) 148 | { 149 | return $this->files->exists($path); 150 | } 151 | 152 | /** 153 | * Build the directory for the class if necessary. 154 | * 155 | * @param string $path 156 | * @return string 157 | */ 158 | protected function makeDirectory($path) 159 | { 160 | if (! $this->files->isDirectory(dirname($path))) { 161 | $this->files->makeDirectory(dirname($path), 0777, true, true); 162 | } 163 | 164 | return $path; 165 | } 166 | 167 | /** 168 | * @param $stub 169 | * @param $path 170 | * @return void 171 | */ 172 | protected function createFileWithStub($stub, $path) 173 | { 174 | $this->makeDirectory($path); 175 | 176 | $content = str_replace([ 177 | 'DummyRootNamespace', 178 | 'DummySingular', 179 | 'DummyPlural', 180 | 'DUMMY_VARIABLE_SINGULAR', 181 | 'DUMMY_VARIABLE_PLURAL', 182 | 'dummyVariableSingular', 183 | 'dummyVariablePlural', 184 | 'dummy-plural', 185 | ], [ 186 | App::getNamespace(), 187 | $this->module, 188 | $this->module->pluralStudly(), 189 | $this->module->snake()->upper(), 190 | $this->module->plural()->snake()->upper(), 191 | lcfirst($this->module), 192 | lcfirst($this->module->pluralStudly()), 193 | lcfirst($this->module->plural()->snake('-')), 194 | ], 195 | $stub 196 | ); 197 | 198 | $this->files->put($path, $content); 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | $this->load(__DIR__.'/Commands'); 39 | 40 | require base_path('routes/console.php'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Contracts/RepositoryInterface.php: -------------------------------------------------------------------------------- 1 | [__('You must :linkOpen verify :linkClose your email first.', [ 18 | 'linkOpen' => '', 19 | 'linkClose' => '', 20 | ])], 21 | ]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, // check if using the same domain 42 | // 'throttle:api', 43 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 44 | ], 45 | ]; 46 | 47 | /** 48 | * The application's route middleware. 49 | * 50 | * These middleware may be assigned to groups or used individually. 51 | * 52 | * @var array 53 | */ 54 | protected $routeMiddleware = [ 55 | 'auth' => \App\Http\Middleware\Authenticate::class, 56 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 57 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 58 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 59 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 60 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 61 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 62 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 63 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 64 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 65 | ]; 66 | 67 | /** 68 | * The priority-sorted list of middleware. 69 | * 70 | * This forces non-global middleware to always be in the given order. 71 | * 72 | * @var array 73 | */ 74 | protected $middlewarePriority = [ 75 | \Illuminate\Session\Middleware\StartSession::class, 76 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 77 | \App\Http\Middleware\Authenticate::class, 78 | \Illuminate\Routing\Middleware\ThrottleRequests::class, 79 | \Illuminate\Session\Middleware\AuthenticateSession::class, 80 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 81 | \Illuminate\Auth\Middleware\Authorize::class, 82 | ]; 83 | } 84 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | abort(403); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | check()) { 22 | return redirect(RouteServiceProvider::HOME); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 'datetime', 51 | ]; 52 | 53 | /** 54 | * The accessors to append to the model's array form. 55 | * 56 | * @var array 57 | */ 58 | protected $appends = [ 59 | 'avatar', 60 | ]; 61 | 62 | /** 63 | * Get the profile photo URL attribute. 64 | * 65 | * @return string 66 | */ 67 | public function getAvatarAttribute() 68 | { 69 | return 'https://www.gravatar.com/avatar/'.md5(strtolower($this->email)).'.jpg?s=200&d=mm'; 70 | } 71 | 72 | /** 73 | * Send the password reset notification. 74 | * 75 | * @param string $token 76 | * @return void 77 | */ 78 | public function sendPasswordResetNotification($token) 79 | { 80 | $this->notify(new ResetPassword($token)); 81 | } 82 | 83 | /** 84 | * Send the email verification notification. 85 | * 86 | * @return void 87 | */ 88 | public function sendEmailVerificationNotification() 89 | { 90 | $this->notify(new VerifyEmail); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/Modules/Auth/Controllers/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/Modules/Auth/Controllers/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 29 | } 30 | 31 | protected function setToken(string $token): void 32 | { 33 | $this->token = $token; 34 | } 35 | 36 | /** 37 | * Attempt to log the user into the application. 38 | * 39 | * @param Request $request 40 | * @return bool 41 | */ 42 | protected function attemptLogin(Request $request) 43 | { 44 | $user = User::where('email', strtolower($request->input($this->username())))->first(); 45 | 46 | if (! $user || ! Hash::check($request->password, $user->password)) { 47 | return false; 48 | } 49 | 50 | $this->guard()->setUser($user); 51 | 52 | if ($user instanceof MustVerifyEmail && ! $user->hasVerifiedEmail()) { 53 | return false; 54 | } 55 | 56 | $this->setToken($user->createToken($request->device_name)->plainTextToken); 57 | 58 | return true; 59 | } 60 | 61 | /** 62 | * Send the response after the user was authenticated. 63 | * 64 | * @param Request $request 65 | * @return JsonResponse 66 | */ 67 | protected function sendLoginResponse(Request $request) 68 | { 69 | $this->clearLoginAttempts($request); 70 | 71 | return response()->json([ 72 | 'token' => $this->token, 73 | ])->header('Authorization', $this->token); 74 | } 75 | 76 | /** 77 | * Get the failed login response instance. 78 | * 79 | * @param Request $request 80 | * @return void 81 | * 82 | * @throws ValidationException 83 | * @throws VerifyEmailException 84 | */ 85 | protected function sendFailedLoginResponse(Request $request) 86 | { 87 | $user = $this->guard()->user(); 88 | if ($user instanceof MustVerifyEmail && ! $user->hasVerifiedEmail()) { 89 | throw VerifyEmailException::forUser($user); 90 | } 91 | 92 | throw ValidationException::withMessages([ 93 | $this->username() => [trans('auth.failed')], 94 | ]); 95 | } 96 | 97 | /** 98 | * Log the user out of the application. 99 | * 100 | * @param Request $request 101 | * @return void 102 | */ 103 | public function logout(Request $request) 104 | { 105 | $request->user()->currentAccessToken()->delete(); 106 | app()->get('auth')->forgetGuards(); 107 | auth('web')->logout(); 108 | } 109 | 110 | /** 111 | * Validate the user login request. 112 | * 113 | * @param Request $request 114 | * @return void 115 | */ 116 | protected function validateLogin(Request $request): void 117 | { 118 | $request->validate([ 119 | $this->username() => 'required|string', 120 | 'password' => 'required|string', 121 | 'device_name' => 'required|string', 122 | ]); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /app/Modules/Auth/Controllers/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 25 | } 26 | 27 | /** 28 | * The user has been registered. 29 | * 30 | * @param Request $request 31 | * @param User $user 32 | * @return JsonResponse 33 | */ 34 | protected function registered(Request $request, User $user) 35 | { 36 | if ($user instanceof MustVerifyEmail) { 37 | return response()->json(['status' => trans('verification.sent')]); 38 | } 39 | 40 | return response()->json($user); 41 | } 42 | 43 | /** 44 | * Get a validator for an incoming registration request. 45 | * 46 | * @param array $data 47 | * @return \Illuminate\Contracts\Validation\Validator 48 | */ 49 | protected function validator(array $data) 50 | { 51 | return Validator::make($data, [ 52 | 'name' => 'required|max:255', 53 | 'email' => 'required|email|max:255|unique:users', 54 | 'password' => 'required|min:6|confirmed', 55 | ]); 56 | } 57 | 58 | /** 59 | * Create a new user instance after a valid registration. 60 | * 61 | * @param array $data 62 | * @return User 63 | */ 64 | protected function create(array $data) 65 | { 66 | return User::create([ 67 | 'name' => $data['name'], 68 | 'email' => $data['email'], 69 | 'password' => bcrypt($data['password']), 70 | ]); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/Modules/Auth/Controllers/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/Modules/Auth/Controllers/UserController.php: -------------------------------------------------------------------------------- 1 | json([ 18 | 'data' => auth()->user(), 19 | ]); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Modules/Auth/Controllers/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('throttle:6,1')->only('verify', 'resend'); 23 | } 24 | 25 | /** 26 | * Mark the user's email address as verified. 27 | * 28 | * @param Request $request 29 | * @param User $user 30 | * @return JsonResponse 31 | */ 32 | public function verify(Request $request, User $user) 33 | { 34 | if (! URL::hasValidSignature($request)) { 35 | return response()->json([ 36 | 'status' => trans('verification.invalid'), 37 | ], 400); 38 | } 39 | 40 | if ($user->hasVerifiedEmail()) { 41 | return response()->json([ 42 | 'status' => trans('verification.already_verified'), 43 | ], 400); 44 | } 45 | 46 | $user->markEmailAsVerified(); 47 | 48 | event(new Verified($user)); 49 | 50 | return response()->json([ 51 | 'status' => trans('verification.verified'), 52 | ]); 53 | } 54 | 55 | /** 56 | * Resend the email verification notification. 57 | * 58 | * @param Request $request 59 | * @return JsonResponse 60 | * @throws ValidationException 61 | */ 62 | public function resend(Request $request) 63 | { 64 | $this->validate($request, ['email' => 'required|email']); 65 | 66 | /** @var User $user */ 67 | $user = User::where('email', $request->email)->first(); 68 | 69 | if (is_null($user)) { 70 | throw ValidationException::withMessages([ 71 | 'email' => [trans('verification.user')], 72 | ]); 73 | } 74 | 75 | if ($user->hasVerifiedEmail()) { 76 | throw ValidationException::withMessages([ 77 | 'email' => [trans('verification.already_verified')], 78 | ]); 79 | } 80 | 81 | $user->sendEmailVerificationNotification(); 82 | 83 | return response()->json(['status' => trans('verification.sent')]); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/Modules/Auth/routes_api.php: -------------------------------------------------------------------------------- 1 | group(function () { 6 | Route::withoutMiddleware('auth:sanctum')->group(function () { 7 | Route::post('login', 'LoginController@login')->name('login'); 8 | Route::post('register', 'RegisterController@register')->name('register'); 9 | 10 | Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('password.reset-email'); 11 | Route::post('password/reset', 'ResetPasswordController@reset')->name('password.reset'); 12 | 13 | Route::post('email/verify/{user}', 'VerificationController@verify')->name('verification.verify'); 14 | Route::post('email/resend', 'VerificationController@resend')->name('verification.resend'); 15 | }); 16 | 17 | Route::post('logout', 'LoginController@logout')->name('logout'); 18 | Route::post('me', 'UserController@me')->name('me'); 19 | }); 20 | -------------------------------------------------------------------------------- /app/Modules/Setting/Controllers/ProfileController.php: -------------------------------------------------------------------------------- 1 | user(); 22 | 23 | $data = $profileRequest->validated(); 24 | $user->fill($data)->save(); 25 | 26 | return response()->json([ 27 | 'type' => self::RESPONSE_TYPE_SUCCESS, 28 | 'message' => 'Successfully updated', 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Modules/Setting/Requests/ProfileRequest.php: -------------------------------------------------------------------------------- 1 | 'required|string', 29 | User::COLUMN_EMAIL => 'required|email|unique:users,email,'.auth()->id(), 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Modules/Setting/routes_api.php: -------------------------------------------------------------------------------- 1 | group(function () { 6 | Route::patch('profile', 'ProfileController@update')->name('profile.update'); 7 | }); 8 | -------------------------------------------------------------------------------- /app/Notifications/ResetPassword.php: -------------------------------------------------------------------------------- 1 | line('You are receiving this email because we received a password reset request for your account.') 20 | ->action('Reset Password', url(config('app.url').'/password/reset/'.$this->token).'?email='.urlencode($notifiable->email)) 21 | ->line('If you did not request a password reset, no further action is required.'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Notifications/VerifyEmail.php: -------------------------------------------------------------------------------- 1 | addMinutes(60), ['user' => $notifiable->id] 21 | ); 22 | 23 | return str_replace('/api/v1/auth', '', $url); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.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 | ['auth:sanctum']]); 18 | 19 | require base_path('routes/channels.php'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 53 | 54 | $this->mapModulesRoutes(); 55 | 56 | $this->mapWebRoutes(); 57 | 58 | $this->mapSPARoutes(); 59 | } 60 | 61 | /** 62 | * Define the "web" routes for the application. 63 | * 64 | * These routes all receive session state, CSRF protection, etc. 65 | * 66 | * @return void 67 | */ 68 | protected function mapWebRoutes() 69 | { 70 | Route::middleware('web') 71 | ->namespace($this->namespace) 72 | ->group(base_path('routes/web.php')); 73 | } 74 | 75 | /** 76 | * Define the "api" routes for the application. 77 | * 78 | * These routes are typically stateless. 79 | * 80 | * @return void 81 | */ 82 | protected function mapApiRoutes() 83 | { 84 | Route::prefix(self::API_PREFIX) 85 | ->middleware('api') 86 | ->namespace($this->namespace) 87 | ->group(base_path('routes/api.php')); 88 | } 89 | 90 | /** 91 | * All non matchable resources we will show standard Vue page,. 92 | * 93 | * and redirect it through VueRoutes on client side 94 | * 95 | * @return void 96 | */ 97 | protected function mapSPARoutes() 98 | { 99 | Route::namespace($this->namespace) 100 | ->middleware('web') 101 | ->group(function () { 102 | Route::view('/{any}', 'spa') 103 | ->where('any', '.*'); 104 | }); 105 | } 106 | 107 | /** 108 | * Define the "modules" routes for the application. 109 | * 110 | * These routes are typically stateless. 111 | * 112 | * @return void 113 | */ 114 | protected function mapModulesRoutes() 115 | { 116 | $modules_folder = app_path('Modules'); 117 | $modules = $this->getModulesList($modules_folder); 118 | 119 | foreach ($modules as $module) { 120 | $routesPath = $modules_folder.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'routes_api.php'; 121 | 122 | if (file_exists($routesPath)) { 123 | Route::prefix(self::API_PREFIX) 124 | ->middleware(['api', 'auth:sanctum']) 125 | ->namespace("\\App\\Modules\\$module\Controllers") 126 | ->group($routesPath); 127 | } 128 | } 129 | } 130 | 131 | /** 132 | * @param string $modules_folder 133 | * @return array 134 | */ 135 | private function getModulesList(string $modules_folder): array 136 | { 137 | return 138 | array_values( 139 | array_filter( 140 | scandir($modules_folder), 141 | function ($item) use ($modules_folder) { 142 | return is_dir($modules_folder.DIRECTORY_SEPARATOR.$item) && ! in_array($item, ['.', '..']); 143 | } 144 | ) 145 | ); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /app/Repositories/AbstractRepository.php: -------------------------------------------------------------------------------- 1 | class) { 26 | $this->model = new $this->class(); 27 | } 28 | } 29 | 30 | /** 31 | * @param int $id 32 | * @return Model|null 33 | */ 34 | public function get(int $id): ?Model 35 | { 36 | return $this->model::find($id); 37 | } 38 | 39 | /** 40 | * @param array $data 41 | * @return Model|null 42 | */ 43 | public function create(array $data): ?Model 44 | { 45 | return $this->model::create($data); 46 | } 47 | 48 | /** 49 | * @param array $data 50 | * @param Model $model 51 | * @return Model 52 | */ 53 | public function update(array $data, Model $model): Model 54 | { 55 | $model->fill($data)->save(); 56 | 57 | return $model; 58 | } 59 | 60 | /** 61 | * @param $id 62 | * @return bool 63 | * @throws \Exception 64 | */ 65 | public function delete(int $id): bool 66 | { 67 | return $this->model::destroy($id); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/Repositories/UserRepository.php: -------------------------------------------------------------------------------- 1 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^8.0", 12 | "ext-json": "*", 13 | "fideloper/proxy": "^4.2", 14 | "fruitcake/laravel-cors": "^2.0", 15 | "guzzlehttp/guzzle": "^7.0.1", 16 | "laravel/framework": "^8.77", 17 | "laravel/sanctum": "^2.14", 18 | "laravel/tinker": "^v2.4.2", 19 | "laravel/ui": "^3.3" 20 | }, 21 | "require-dev": { 22 | "brianium/paratest": "^6.4", 23 | "facade/ignition": "^2.17", 24 | "fakerphp/faker": "^1.9.1", 25 | "matt-allan/laravel-code-style": "^0.7.0", 26 | "mockery/mockery": "^1.4", 27 | "nunomaduro/collision": "^5.0", 28 | "phpunit/phpunit": "^9.5" 29 | }, 30 | "config": { 31 | "optimize-autoloader": true, 32 | "preferred-install": "dist", 33 | "sort-packages": true 34 | }, 35 | "extra": { 36 | "laravel": { 37 | "dont-discover": [] 38 | } 39 | }, 40 | "autoload": { 41 | "psr-4": { 42 | "App\\": "app/", 43 | "Database\\Factories\\": "database/factories/", 44 | "Database\\Seeders\\": "database/seeders/" 45 | } 46 | }, 47 | "autoload-dev": { 48 | "psr-4": { 49 | "Tests\\": "tests/" 50 | } 51 | }, 52 | "minimum-stability": "dev", 53 | "prefer-stable": true, 54 | "scripts": { 55 | "post-autoload-dump": [ 56 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 57 | "@php artisan package:discover --ansi" 58 | ], 59 | "post-root-package-install": [ 60 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 61 | ], 62 | "post-create-project-cmd": [ 63 | "@php artisan key:generate --ansi" 64 | ], 65 | "clear-all": [ 66 | "@php artisan clear-compiled", 67 | "@php artisan cache:clear", 68 | "@php artisan route:clear", 69 | "@php artisan view:clear", 70 | "@php artisan config:clear", 71 | "composer dumpautoload -o" 72 | ], 73 | "cache-all": [ 74 | "@php artisan config:cache", 75 | "@php artisan route:cache" 76 | ], 77 | "test": "@php artisan test --parallel", 78 | "check-style": "php-cs-fixer fix --dry-run --diff", 79 | "fix-style": "php-cs-fixer fix" 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'sanctum', 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 | ], 43 | 44 | 'database' => [ 45 | 'driver' => 'database', 46 | 'table' => 'cache', 47 | 'connection' => null, 48 | ], 49 | 50 | 'file' => [ 51 | 'driver' => 'file', 52 | 'path' => storage_path('framework/cache/data'), 53 | ], 54 | 55 | 'memcached' => [ 56 | 'driver' => 'memcached', 57 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 58 | 'sasl' => [ 59 | env('MEMCACHED_USERNAME'), 60 | env('MEMCACHED_PASSWORD'), 61 | ], 62 | 'options' => [ 63 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 64 | ], 65 | 'servers' => [ 66 | [ 67 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 68 | 'port' => env('MEMCACHED_PORT', 11211), 69 | 'weight' => 100, 70 | ], 71 | ], 72 | ], 73 | 74 | 'redis' => [ 75 | 'driver' => 'redis', 76 | 'connection' => 'cache', 77 | ], 78 | 79 | 'dynamodb' => [ 80 | 'driver' => 'dynamodb', 81 | 'key' => env('AWS_ACCESS_KEY_ID'), 82 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 83 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 84 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 85 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 86 | ], 87 | 88 | ], 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Cache Key Prefix 93 | |-------------------------------------------------------------------------- 94 | | 95 | | When utilizing a RAM based store such as APC or Memcached, there might 96 | | be other applications utilizing the same cache. So, we'll specify a 97 | | value to get prefixed to all our keys so we can avoid collisions. 98 | | 99 | */ 100 | 101 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 102 | 103 | ]; 104 | -------------------------------------------------------------------------------- /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 | 'sqlite_dusk' => [ 47 | 'driver' => 'sqlite', 48 | 'url' => env('DATABASE_URL'), 49 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 50 | 'prefix' => '', 51 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 52 | ], 53 | 54 | 'mysql' => [ 55 | 'driver' => 'mysql', 56 | 'url' => env('DATABASE_URL'), 57 | 'host' => env('DB_HOST', '127.0.0.1'), 58 | 'port' => env('DB_PORT', '3306'), 59 | 'database' => env('DB_DATABASE', 'forge'), 60 | 'username' => env('DB_USERNAME', 'forge'), 61 | 'password' => env('DB_PASSWORD', ''), 62 | 'unix_socket' => env('DB_SOCKET', ''), 63 | 'charset' => 'utf8mb4', 64 | 'collation' => 'utf8mb4_unicode_ci', 65 | 'prefix' => '', 66 | 'prefix_indexes' => true, 67 | 'strict' => true, 68 | 'engine' => null, 69 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 70 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 71 | ]) : [], 72 | ], 73 | 74 | 'pgsql' => [ 75 | 'driver' => 'pgsql', 76 | 'url' => env('DATABASE_URL'), 77 | 'host' => env('DB_HOST', '127.0.0.1'), 78 | 'port' => env('DB_PORT', '5432'), 79 | 'database' => env('DB_DATABASE', 'forge'), 80 | 'username' => env('DB_USERNAME', 'forge'), 81 | 'password' => env('DB_PASSWORD', ''), 82 | 'charset' => 'utf8', 83 | 'prefix' => '', 84 | 'prefix_indexes' => true, 85 | 'schema' => 'public', 86 | 'sslmode' => 'prefer', 87 | ], 88 | 89 | 'sqlsrv' => [ 90 | 'driver' => 'sqlsrv', 91 | 'url' => env('DATABASE_URL'), 92 | 'host' => env('DB_HOST', 'localhost'), 93 | 'port' => env('DB_PORT', '1433'), 94 | 'database' => env('DB_DATABASE', 'forge'), 95 | 'username' => env('DB_USERNAME', 'forge'), 96 | 'password' => env('DB_PASSWORD', ''), 97 | 'charset' => 'utf8', 98 | 'prefix' => '', 99 | 'prefix_indexes' => true, 100 | ], 101 | 102 | ], 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Migration Repository Table 107 | |-------------------------------------------------------------------------- 108 | | 109 | | This table keeps track of all the migrations that have already run for 110 | | your application. Using this information, we can determine which of 111 | | the migrations on disk haven't actually been run in the database. 112 | | 113 | */ 114 | 115 | 'migrations' => 'migrations', 116 | 117 | /* 118 | |-------------------------------------------------------------------------- 119 | | Redis Databases 120 | |-------------------------------------------------------------------------- 121 | | 122 | | Redis is an open source, fast, and advanced key-value store that also 123 | | provides a richer body of commands than a typical key-value system 124 | | such as APC or Memcached. Laravel makes it easy to dig right in. 125 | | 126 | */ 127 | 128 | 'redis' => [ 129 | 130 | 'client' => env('REDIS_CLIENT', 'phpredis'), 131 | 132 | 'options' => [ 133 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 134 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 135 | ], 136 | 137 | 'default' => [ 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_DB', '0'), 143 | ], 144 | 145 | 'cache' => [ 146 | 'url' => env('REDIS_URL'), 147 | 'host' => env('REDIS_HOST', '127.0.0.1'), 148 | 'password' => env('REDIS_PASSWORD', null), 149 | 'port' => env('REDIS_PORT', '6379'), 150 | 'database' => env('REDIS_CACHE_DB', '1'), 151 | ], 152 | 153 | ], 154 | 155 | ]; 156 | -------------------------------------------------------------------------------- /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 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/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' => 'debug', 48 | ], 49 | 50 | 'daily' => [ 51 | 'driver' => 'daily', 52 | 'path' => storage_path('logs/laravel.log'), 53 | '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' => 'critical', 63 | ], 64 | 65 | 'papertrail' => [ 66 | 'driver' => 'monolog', 67 | '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' => 'debug', 87 | ], 88 | 89 | 'errorlog' => [ 90 | 'driver' => 'errorlog', 91 | '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_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => [ 59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 60 | 'name' => env('MAIL_FROM_NAME', 'Example'), 61 | ], 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | E-Mail Encryption Protocol 66 | |-------------------------------------------------------------------------- 67 | | 68 | | Here you may specify the encryption protocol that should be used when 69 | | the application send e-mail messages. A sensible default using the 70 | | transport layer security protocol should provide great security. 71 | | 72 | */ 73 | 74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | SMTP Server Username 79 | |-------------------------------------------------------------------------- 80 | | 81 | | If your SMTP server requires a username for authentication, you should 82 | | set it here. This will get used to authenticate with your server on 83 | | connection. You may also set the "password" value below this one. 84 | | 85 | */ 86 | 87 | 'username' => env('MAIL_USERNAME'), 88 | 89 | 'password' => env('MAIL_PASSWORD'), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Sendmail System Path 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When using the "sendmail" driver to send e-mails, we will need to know 97 | | the path to where Sendmail lives on this server. A default path has 98 | | been provided here, which will work well on most of your systems. 99 | | 100 | */ 101 | 102 | 'sendmail' => '/usr/sbin/sendmail -bs', 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Markdown Mail Settings 107 | |-------------------------------------------------------------------------- 108 | | 109 | | If you are using Markdown based email rendering, you may configure your 110 | | theme and component paths here, allowing you to customize the design 111 | | of the emails. Or, you may simply stick with the Laravel defaults! 112 | | 113 | */ 114 | 115 | 'markdown' => [ 116 | 'theme' => 'default', 117 | 118 | 'paths' => [ 119 | resource_path('views/vendor/mail'), 120 | ], 121 | ], 122 | 123 | /* 124 | |-------------------------------------------------------------------------- 125 | | Log Channel 126 | |-------------------------------------------------------------------------- 127 | | 128 | | If you are using the "log" driver, you may specify the logging channel 129 | | if you prefer to keep mail messages separate from other log entries 130 | | for simpler reading. Otherwise, the default channel will be used. 131 | | 132 | */ 133 | 134 | 'log_channel' => env('MAIL_LOG_CHANNEL'), 135 | 136 | ]; 137 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | 'block_for' => 0, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => env('AWS_ACCESS_KEY_ID'), 55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 58 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 59 | ], 60 | 61 | 'redis' => [ 62 | 'driver' => 'redis', 63 | 'connection' => 'default', 64 | 'queue' => env('REDIS_QUEUE', 'default'), 65 | 'retry_after' => 90, 66 | 'block_for' => null, 67 | ], 68 | 69 | ], 70 | 71 | /* 72 | |-------------------------------------------------------------------------- 73 | | Failed Queue Jobs 74 | |-------------------------------------------------------------------------- 75 | | 76 | | These options configure the behavior of failed queue job logging so you 77 | | can control which database and table are used to store the jobs that 78 | | have failed. You may change them to any database / table you wish. 79 | | 80 | */ 81 | 82 | 'failed' => [ 83 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 84 | 'database' => env('DB_CONNECTION', 'mysql'), 85 | 'table' => 'failed_jobs', 86 | ], 87 | 88 | ]; 89 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 17 | '%s%s', 18 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 19 | env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' 20 | ))), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Sanctum Guards 25 | |-------------------------------------------------------------------------- 26 | | 27 | | This array contains the authentication guards that will be checked when 28 | | Sanctum is trying to authenticate a request. If none of these guards 29 | | are able to authenticate the request, Sanctum will use the bearer 30 | | token that's present on an incoming request for authentication. 31 | | 32 | */ 33 | 34 | 'guard' => ['web'], 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Expiration Minutes 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This value controls the number of minutes until an issued token will be 42 | | considered expired. If this value is null, personal access tokens do 43 | | not expire. This won't tweak the lifetime of first-party sessions. 44 | | 45 | */ 46 | 47 | 'expiration' => null, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Sanctum Middleware 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When authenticating your first-party SPA with Sanctum you may need to 55 | | customize some of the middleware Sanctum uses while processing the 56 | | request. You may change the middleware listed below as required. 57 | | 58 | */ 59 | 60 | 'middleware' => [ 61 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 62 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 63 | ], 64 | 65 | ]; 66 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'postmark' => [ 24 | 'token' => env('POSTMARK_TOKEN'), 25 | ], 26 | 27 | 'ses' => [ 28 | 'key' => env('AWS_ACCESS_KEY_ID'), 29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 31 | ], 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /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 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 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/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->text('connection'); 19 | $table->text('queue'); 20 | $table->longText('payload'); 21 | $table->longText('exception'); 22 | $table->timestamp('failed_at')->useCurrent(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('failed_jobs'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('personal_access_tokens'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js", 11 | "lint": "./node_modules/.bin/eslint -c .eslintrc.js --ignore-path .gitignore resources/js/** --ext .js,.vue --max-warnings=0", 12 | "lint-fix": "./node_modules/.bin/eslint -c .eslintrc.js --ignore-path .gitignore resources/js/** --ext .js,.vue --fix" 13 | }, 14 | "lint-staged": { 15 | "*.{js,vue}": [ 16 | "./node_modules/.bin/eslint -c .eslintrc.js --fix --max-warnings=0" 17 | ], 18 | "*.php": [ 19 | "vendor/bin/php-cs-fixer fix --diff --config=.php-cs-fixer.dist.php" 20 | ] 21 | }, 22 | "husky": { 23 | "hooks": { 24 | "pre-commit": "lint-staged" 25 | } 26 | }, 27 | "devDependencies": { 28 | "babel-eslint": "^10.1.0", 29 | "browser-sync": "^2.26.14", 30 | "browser-sync-webpack-plugin": "^2.0.1", 31 | "eslint": "^7.20.0", 32 | "eslint-plugin-vue": "^7.6.0", 33 | "husky": "4", 34 | "lint-staged": "11.1.2" 35 | }, 36 | "dependencies": { 37 | "@fortawesome/fontawesome-free": "5.15.4", 38 | "@websanova/vue-auth": "4.1.8", 39 | "axios": "^0.24.0", 40 | "cross-env": "^7.0.3", 41 | "dayjs": "^1.10.7", 42 | "element-ui": "2.15.6", 43 | "laravel-mix": "^6.0.39", 44 | "lodash": "4.17.21", 45 | "postcss": "^8.4.5", 46 | "resolve-url-loader": "4.0.0", 47 | "sass": "1.45.2", 48 | "sass-loader": "12.4.0", 49 | "vue": "^2.6.14", 50 | "vue-axios": "^3.4.0", 51 | "vue-i18n": "8.26.8", 52 | "vue-loader": "^15.9.7", 53 | "vue-router": "3.5.3", 54 | "vue-template-compiler": "^2.6.14", 55 | "vuex": "3.6.2" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | ./tests/Unit 16 | 17 | 18 | 19 | ./tests/Feature 20 | 21 | 22 | 23 | 24 | ./app 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yurich84/laravel-vue-spa-skeleton/fed0b2fa6ea26a0ee17858d67117a8b6639531f9/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /public/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yurich84/laravel-vue-spa-skeleton/fed0b2fa6ea26a0ee17858d67117a8b6639531f9/public/preview.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './core/App' 3 | import ElementUI from 'element-ui' 4 | import i18n from './bootstrap/i18n' 5 | import router from './bootstrap/router' 6 | import store from './core/store' 7 | import globalMixin from './includes/mixins/globalMixin' 8 | import auth from './bootstrap/auth' 9 | import './bootstrap/day' 10 | 11 | Vue.use(ElementUI, {i18n: (key, value) => i18n.t(key, value)}) 12 | 13 | Vue.prototype.config = window.config 14 | 15 | Vue.mixin(globalMixin) 16 | 17 | window.Vue = new Vue({ 18 | router, 19 | store, 20 | auth, 21 | i18n, 22 | render: h => h(App) 23 | }).$mount('#app') 24 | -------------------------------------------------------------------------------- /resources/js/bootstrap/auth.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueAxios from 'vue-axios' 3 | import axios from 'axios' 4 | import {Message} from 'element-ui' 5 | import i18n, {setI18nLanguage} from '@/bootstrap/i18n' 6 | 7 | import VueAuth from '@websanova/vue-auth/dist/v2/vue-auth.esm' 8 | import driverAuthBearer from '@websanova/vue-auth/dist/drivers/auth/bearer.esm.js' 9 | import driverHttpAxios from '@websanova/vue-auth/dist/drivers/http/axios.1.x.esm.js' 10 | import driverRouterVueRouter from '@websanova/vue-auth/dist/drivers/router/vue-router.2.x.esm.js' 11 | 12 | Vue.use(VueAxios, axios) 13 | let token = document.head.querySelector('meta[name="csrf-token"]') 14 | axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content 15 | axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' 16 | axios.defaults.baseURL = process.env.MIX_API_ENDPOINT 17 | axios.defaults.withCredentials = true 18 | 19 | // Response interceptor 20 | axios.interceptors.response.use(response => response, error => { 21 | if (error.response.data.message) { 22 | console.error('--- ', error.response.data.message) 23 | } 24 | if (error.response.status >= 500) { 25 | Message.error(i18n.t('global.unknown_server_error').toString()) 26 | } else if (error.response.data.message) { 27 | Message.error(error.response.data.message) 28 | } 29 | 30 | return Promise.reject(error) 31 | }) 32 | 33 | export default new VueAuth(Vue, { 34 | plugins : { 35 | http : axios, 36 | router : Vue.router 37 | }, 38 | drivers : { 39 | http : driverHttpAxios, 40 | auth : driverAuthBearer, 41 | router : driverRouterVueRouter, 42 | }, 43 | options : { 44 | loginData: {url: process.env.MIX_API_ENDPOINT + 'auth/login', redirect: {name: 'Dashboard'}}, 45 | logoutData: {url: process.env.MIX_API_ENDPOINT + 'auth/logout', redirect: {name: 'Login'}, makeRequest: true}, 46 | registerData: {url: process.env.MIX_API_ENDPOINT + 'auth/register', method: 'POST', redirect: {name: 'Login'}}, 47 | fetchData: {url: process.env.MIX_API_ENDPOINT + 'auth/me', method: 'POST'}, 48 | refreshData: {enabled: false}, 49 | rolesKey: 'all_permissions', 50 | parseUserData: function (data) { 51 | setI18nLanguage(data.data.locale || 'en') 52 | return data.data || {} 53 | }, 54 | } 55 | }) 56 | -------------------------------------------------------------------------------- /resources/js/bootstrap/day.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import * as dayjs from 'dayjs' 3 | import 'dayjs/locale/en' 4 | 5 | const dayPlugin = { 6 | install(Vue) { 7 | Vue.prototype.dayjs = dayjs 8 | } 9 | } 10 | 11 | Vue.use(dayPlugin) 12 | 13 | window.dayjs = dayjs 14 | 15 | export const changeDayjsLocale = function (locale) { 16 | dayjs.locale(locale) 17 | } 18 | 19 | -------------------------------------------------------------------------------- /resources/js/bootstrap/i18n.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueI18n from 'vue-i18n' 3 | import messages from './../includes/lang' 4 | import axios from 'axios' 5 | import {changeDayjsLocale} from './day' 6 | 7 | Vue.use(VueI18n) 8 | 9 | const DEFAULT_LANGUAGE = 'en' 10 | 11 | changeDayjsLocale(DEFAULT_LANGUAGE) 12 | 13 | const i18n = new VueI18n({ 14 | locale: DEFAULT_LANGUAGE, 15 | messages, 16 | silentTranslationWarn: true 17 | }) 18 | 19 | setI18nLanguage(DEFAULT_LANGUAGE) 20 | 21 | export function setI18nLanguage (lang) { 22 | changeDayjsLocale(DEFAULT_LANGUAGE) 23 | i18n.locale = lang 24 | axios.defaults.headers.common['Accept-Language'] = lang 25 | document.querySelector('html').setAttribute('lang', lang) 26 | return lang 27 | } 28 | 29 | export default i18n 30 | -------------------------------------------------------------------------------- /resources/js/bootstrap/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import {routes} from '../core/routes' 4 | 5 | Vue.use(VueRouter) 6 | 7 | const router = new VueRouter({ 8 | routes, 9 | mode: 'history', 10 | scrollBehavior(to, from, savedPosition) { 11 | return new Promise((resolve) => { 12 | if (to.hash) { 13 | resolve({ selector: to.hash }) 14 | } else if (savedPosition) { 15 | resolve(savedPosition) 16 | } else { 17 | resolve({x: 0, y: 0}) 18 | } 19 | }) 20 | } 21 | }) 22 | 23 | Vue.router = router 24 | 25 | export default router 26 | -------------------------------------------------------------------------------- /resources/js/core/App.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 28 | 29 | 53 | -------------------------------------------------------------------------------- /resources/js/core/components/Breadcrumbs.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 27 | 28 | 31 | -------------------------------------------------------------------------------- /resources/js/core/components/Home.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 54 | 55 | 211 | -------------------------------------------------------------------------------- /resources/js/core/components/Index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 20 | 21 | 26 | -------------------------------------------------------------------------------- /resources/js/core/components/Navbar.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 76 | -------------------------------------------------------------------------------- /resources/js/core/components/NotFound.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /resources/js/core/components/Sidebar.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 81 | 82 | 85 | -------------------------------------------------------------------------------- /resources/js/core/components/Welcome.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 33 | 34 | 75 | -------------------------------------------------------------------------------- /resources/js/core/constants/time.constants.js: -------------------------------------------------------------------------------- 1 | export const DATETIME_DB_FORMAT = 'YYYY-MM-DD HH:mm:ss' 2 | export const DATE_DB_FORMAT = 'YYYY-MM-DD' 3 | 4 | export const DATETIME_FORMAT = 'DD/MM/YYYY HH:mm' 5 | export const DATE_FORMAT = 'DD/MM/YYYY' 6 | export const TIME_FORMAT = 'HH:mm' 7 | 8 | export const DATE_PIKER_FORMAT = 'dd/MM/yyyy' 9 | export const MONTH_PIKER_FORMAT = 'MMM yyyy' 10 | export const DATATIME_PIKER_FORMAT = 'dd/MM/yyyy HH:mm' 11 | -------------------------------------------------------------------------------- /resources/js/core/routes.js: -------------------------------------------------------------------------------- 1 | import Index from './components/Index' 2 | import NotFound from './components/NotFound' 3 | import Welcome from './components/Welcome' 4 | import Home from './components/Home' 5 | import auth from '../modules/auth/routes_auth' 6 | 7 | // Load modules routes dynamically. 8 | const requireContext = require.context('../modules', true, /routes\.js$/) 9 | 10 | const modules = requireContext.keys() 11 | .map(file => 12 | [file.replace(/(^.\/)|(\.js$)/g, ''), requireContext(file)] 13 | ) 14 | 15 | let moduleRoutes = [] 16 | 17 | for(let i in modules) { 18 | moduleRoutes = moduleRoutes.concat(modules[i][1].routes) 19 | } 20 | 21 | export const routes = [ 22 | { 23 | path: '/admin', 24 | component: Home, 25 | meta: {auth: true}, 26 | children: [ 27 | ...moduleRoutes, 28 | ] 29 | }, 30 | { 31 | path: '/', 32 | component: Welcome, 33 | children: [ 34 | { 35 | path: '/', 36 | component: Index, 37 | name: 'index', 38 | }, 39 | ...auth, 40 | { 41 | path: '*', 42 | component: NotFound, 43 | name: 'not_found' 44 | } 45 | ] 46 | }, 47 | ] 48 | 49 | -------------------------------------------------------------------------------- /resources/js/core/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import {store as core} from './store' 4 | 5 | Vue.use(Vuex) 6 | 7 | // Load store modules dynamically. 8 | const requireContext = require.context('../../modules', true, /store\.js$/) 9 | 10 | let modules = requireContext.keys() 11 | .map(file => 12 | [file.replace(/(^.\/)|(\.js$)/g, ''), requireContext(file)] 13 | ) 14 | .reduce((modules, [path, module]) => { 15 | let name = path.split('/')[0] 16 | return { ...modules, [name]: module.store } 17 | }, {}) 18 | 19 | modules = {...modules, core} 20 | 21 | export default new Vuex.Store({ 22 | modules 23 | }) 24 | -------------------------------------------------------------------------------- /resources/js/core/store/store.js: -------------------------------------------------------------------------------- 1 | import * as types from './types' 2 | 3 | let collapsed = false 4 | if (window.innerWidth < 768) { 5 | collapsed = true 6 | } 7 | 8 | export const store = { 9 | state: { 10 | isCollapsed: collapsed 11 | }, 12 | mutations: { 13 | [types.TOGGLE_COLLAPSE](state) { 14 | state.isCollapsed = !state.isCollapsed 15 | }, 16 | }, 17 | getters: { 18 | coreIsCollapsed: state => state.isCollapsed 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /resources/js/core/store/types.js: -------------------------------------------------------------------------------- 1 | // Mutations 2 | export const TOGGLE_COLLAPSE = 'core.toggle_collapsed' 3 | -------------------------------------------------------------------------------- /resources/js/includes/Errors.js: -------------------------------------------------------------------------------- 1 | export class Errors { 2 | /** 3 | * Create a new Errors instance. 4 | */ 5 | constructor() { 6 | this.errors = {} 7 | } 8 | 9 | 10 | /** 11 | * Determine if an errors exists for the given field. 12 | * 13 | * @param {string} field 14 | */ 15 | has(field) { 16 | return this.errors.hasOwnProperty(field) 17 | } 18 | 19 | 20 | /** 21 | * Determine if we have any errors. 22 | */ 23 | any() { 24 | return Object.keys(this.errors).length > 0 25 | } 26 | 27 | 28 | /** 29 | * Retrieve the error message for a field. 30 | * 31 | * @param {string} field 32 | */ 33 | get(field) { 34 | if (this.errors[field]) { 35 | return this.errors[field][0] 36 | } 37 | } 38 | 39 | /** 40 | * Retrieve flash message if any 41 | * 42 | * @param {string} field 43 | */ 44 | getFlash(field) { 45 | if (this.errors[field]) { 46 | return this.errors[field] 47 | } 48 | } 49 | 50 | 51 | /** 52 | * Record the new errors. 53 | * 54 | * @param {object} errors 55 | */ 56 | record(errors) { 57 | this.errors = errors 58 | } 59 | 60 | 61 | /** 62 | * Clear one or all error fields. 63 | * 64 | * @param {string|null} field 65 | */ 66 | clear(field) { 67 | if (field) { 68 | if (this.has(field)) { 69 | delete this.errors[field] 70 | } 71 | 72 | return 73 | } 74 | 75 | this.errors = {} 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /resources/js/includes/lang/en.js: -------------------------------------------------------------------------------- 1 | import enLocale from 'element-ui/lib/locale/lang/en' 2 | 3 | export const messages = { 4 | global: { 5 | ok: 'Ok', 6 | cancel: 'Cancel', 7 | save: 'Save', 8 | add: 'Add', 9 | edit: 'Edit', 10 | delete: 'Delete', 11 | new: 'New', 12 | search: 'Search...', 13 | unknown_server_error: 'Unknown server error', 14 | form: { 15 | rules: { 16 | required: 'Field "{fieldName}" is required', 17 | email: 'Please input correct email address', 18 | min: 'Field length "{fieldName}" must be more then {attribute} characters', 19 | max: 'Field length "{fieldName}" must be less then {attribute} characters', 20 | password_repeat: { 21 | different: 'Mismatch passwords', 22 | } 23 | } 24 | }, 25 | }, 26 | auth: { 27 | token_expired_alert_title: 'Session Expired!', 28 | token_expired_alert_text: 'Please log in again to continue.', 29 | verification: { 30 | resend_link: 'Resend verification', 31 | resend_title: 'Resend verification', 32 | resend_button: 'Send', 33 | failed: 'The verification link is invalid.', 34 | }, 35 | resend_verification_link: 'Resend verification email', 36 | login: { 37 | title: 'Login', 38 | submit_button: 'Sign In', 39 | email_label: 'Email', 40 | password_label: 'Password', 41 | }, 42 | logout: { 43 | title: 'Logout', 44 | }, 45 | register: { 46 | title: 'Register', 47 | name_label: 'Name', 48 | email_label: 'Email', 49 | password_label: 'Password', 50 | password_confirmation_label: 'Repeat password', 51 | submit_button: 'Sign Up', 52 | success: 'Thanks for registration.' 53 | }, 54 | logout_confirm: { 55 | title: 'Confirm LogOut', 56 | text: 'You will be logged out', 57 | button_ok: 'Ok', 58 | button_cancel: 'Cancel', 59 | } 60 | }, 61 | setting: { 62 | profile: { 63 | name: 'Name', 64 | email: 'Email', 65 | } 66 | }, 67 | ...enLocale 68 | } 69 | -------------------------------------------------------------------------------- /resources/js/includes/lang/index.js: -------------------------------------------------------------------------------- 1 | import {messages as en} from './en' 2 | import {messages as ru} from './ru' 3 | 4 | export default { 5 | en, 6 | ru 7 | } 8 | -------------------------------------------------------------------------------- /resources/js/includes/lang/ru.js: -------------------------------------------------------------------------------- 1 | import ruLocale from 'element-ui/lib/locale/lang/ru-RU' 2 | 3 | export const messages = { 4 | global: { 5 | ok: 'Ok', 6 | cancel: 'Отмена', 7 | save: 'Сохранить', 8 | add: 'Добавить', 9 | edit: 'Редактировать', 10 | delete: 'Удалить', 11 | new: 'Новый', 12 | search: 'Искать...', 13 | unknown_server_error: 'Неизвестная ошибка сервера', 14 | form: { 15 | rules: { 16 | required: 'Поле "{fieldName}" обезательно', 17 | email: 'Пожалуйста введите корректный email', 18 | min: 'Длинна поля "{fieldName}" должна быть больше {attribute} символов', 19 | max: 'Длинна поля "{fieldName}" должна быть меньше {attribute} символов', 20 | password_repeat: { 21 | different: 'Пароли не совпадают', 22 | } 23 | } 24 | }, 25 | }, 26 | auth: { 27 | token_expired_alert_title: 'Сессия истекла!', 28 | token_expired_alert_text: 'Пожалуйска зайдите слова.', 29 | verification: { 30 | resend_link: 'Отправить имейл о верификации еще раз', 31 | resend_title: 'Отправка имейла о верификации', 32 | resend_button: 'Отправить', 33 | failed: 'Ссылка не действительная.', 34 | }, 35 | resend_verification_link: 'Отправить имейл о верификации еще раз', 36 | login: { 37 | title: 'Войти', 38 | submit_button: 'Войти', 39 | email_label: 'Email', 40 | password_label: 'Пароль', 41 | }, 42 | logout: { 43 | title: 'Выйти', 44 | }, 45 | register: { 46 | title: 'Зарегестрироваться', 47 | name_label: 'Имя', 48 | email_label: 'Email', 49 | password_label: 'Пароль', 50 | password_confirmation_label: 'Повторите пароль', 51 | submit_button: 'Отправить', 52 | success: 'Спасибо за регистрацию.' 53 | }, 54 | logout_confirm: { 55 | title: 'Подтвердите выход', 56 | text: 'Вы будете розлогинены', 57 | button_ok: 'Ok', 58 | button_cancel: 'Отмена', 59 | } 60 | }, 61 | setting: { 62 | profile: { 63 | name: 'Имя', 64 | email: 'Email', 65 | } 66 | }, 67 | ...ruLocale 68 | } 69 | -------------------------------------------------------------------------------- /resources/js/includes/mixins/globalMixin.js: -------------------------------------------------------------------------------- 1 | import {DATE_FORMAT, DATETIME_DB_FORMAT, DATETIME_FORMAT} from '@/core/constants/time.constants' 2 | 3 | export default { 4 | data: () => ({ 5 | globalPageSize: 10, 6 | }), 7 | filters: { 8 | capitalize: function (value) { 9 | if (!value) return '' 10 | value = value.toString() 11 | return value.charAt(0).toUpperCase() + value.slice(1) 12 | }, 13 | price: function (number) { 14 | return Number(number).toString().replace(/\B(?=(\d{3})+(?!\d))/g, '\'') 15 | }, 16 | date: function (datetime) { 17 | return dayjs(datetime).isValid() ? dayjs(datetime, DATETIME_DB_FORMAT).format(DATE_FORMAT) : '' 18 | }, 19 | time: function (datetime) { 20 | return dayjs(datetime).isValid() ? dayjs(datetime, DATETIME_DB_FORMAT).format(DATETIME_FORMAT) : '' 21 | }, 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /resources/js/modules/auth/api/index.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | const API_ENDPOINT = 'auth' 4 | 5 | export default { 6 | 7 | verify(user, query) { 8 | return axios.post(`${API_ENDPOINT}/email/verify/${user}?${query}`) 9 | }, 10 | 11 | resend() { 12 | return axios.post(`${API_ENDPOINT}/email/resend`) 13 | }, 14 | 15 | } 16 | -------------------------------------------------------------------------------- /resources/js/modules/auth/components/Login.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 41 | 42 | 45 | -------------------------------------------------------------------------------- /resources/js/modules/auth/components/LoginForm.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 93 | 94 | 111 | -------------------------------------------------------------------------------- /resources/js/modules/auth/components/Register.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 46 | 47 | 50 | -------------------------------------------------------------------------------- /resources/js/modules/auth/components/RegisterForm.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 148 | 149 | 152 | -------------------------------------------------------------------------------- /resources/js/modules/auth/components/ResendVerification.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 69 | 70 | 73 | -------------------------------------------------------------------------------- /resources/js/modules/auth/components/VerifyEmail.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 62 | 63 | 66 | -------------------------------------------------------------------------------- /resources/js/modules/auth/routes_auth.js: -------------------------------------------------------------------------------- 1 | import Login from './components/Login' 2 | import Register from './components/Register' 3 | import VerifyEmail from './components/VerifyEmail' 4 | import ResendVerification from './components/ResendVerification' 5 | 6 | export default [ 7 | { 8 | path: '/login', 9 | component: Login, 10 | name: 'Login', 11 | meta: { 12 | auth: false, 13 | }, 14 | }, 15 | { 16 | path: '/register', 17 | component: Register, 18 | name: 'Register', 19 | meta: { 20 | auth: false, 21 | }, 22 | }, 23 | { 24 | path: 'email/verify/:user', 25 | component: VerifyEmail, 26 | name: 'Verification email' 27 | }, 28 | { 29 | path: 'email/resend/verification', 30 | component: ResendVerification, 31 | name: 'Verification resend' 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /resources/js/modules/auth/store/store.js: -------------------------------------------------------------------------------- 1 | import * as types from './types' 2 | 3 | export const store = { 4 | state: { 5 | isAuth: false, 6 | }, 7 | mutations: { 8 | [types.SET_AUTH](state, isAuth) { 9 | state.isAuth = isAuth 10 | }, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /resources/js/modules/auth/store/types.js: -------------------------------------------------------------------------------- 1 | // Mutations 2 | export const SET_AUTH = 'auth.set' 3 | 4 | -------------------------------------------------------------------------------- /resources/js/modules/dashboard/components/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /resources/js/modules/dashboard/routes.js: -------------------------------------------------------------------------------- 1 | import Dashboard from './components/Dashboard' 2 | 3 | export const routes = [ 4 | { 5 | path: '/', 6 | name: 'Dashboard', 7 | component: Dashboard, 8 | iconCls: 'el-icon-menu' 9 | }, 10 | ] 11 | -------------------------------------------------------------------------------- /resources/js/modules/notification/components/notificationMixin.js: -------------------------------------------------------------------------------- 1 | import {mapGetters, mapMutations} from 'vuex' 2 | import * as notificationTypes from '../store/types' 3 | 4 | export default { 5 | name: 'Notificator', 6 | render(h) { 7 | return h 8 | }, 9 | computed: { 10 | ...mapGetters(['notificationMessages']) 11 | }, 12 | watch: { 13 | notificationMessages: function (newValue) { 14 | if (newValue.length) { 15 | newValue.forEach(m => this.showMessage(m)) 16 | this[notificationTypes.CLEAR_NOTIFICATION_MESSAGES]() 17 | } 18 | } 19 | }, 20 | methods: { 21 | ...mapMutations([ 22 | notificationTypes.CLEAR_NOTIFICATION_MESSAGES, 23 | ]), 24 | showMessage(message) { 25 | switch (message.type) { 26 | case notificationTypes.ERROR_MESSAGE: 27 | this.$message.error(message.message) 28 | break 29 | case notificationTypes.WARNING_MESSAGE: 30 | case notificationTypes.SUCCESS_MESSAGE: 31 | this.$message({ 32 | ...message 33 | }) 34 | break 35 | case notificationTypes.COMMON_MESSAGE: 36 | this.$notify({ 37 | ...message.message 38 | }) 39 | 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /resources/js/modules/notification/store/store.js: -------------------------------------------------------------------------------- 1 | import * as fromTypes from './types' 2 | 3 | export const store = { 4 | state: { 5 | messages: [] 6 | }, 7 | getters: { 8 | notificationMessages: state => state.messages 9 | }, 10 | mutations: { 11 | [fromTypes.RAISE_ERROR](store, message) { 12 | store.messages.push({ 13 | type: 'error', 14 | message: message 15 | }) 16 | }, 17 | [fromTypes.CLEAR_NOTIFICATION_MESSAGES](store) { 18 | store.messages = [] 19 | }, 20 | [fromTypes.NOTIFY](store, message) { 21 | store.messages.push(message) 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /resources/js/modules/notification/store/types.js: -------------------------------------------------------------------------------- 1 | // Mutations 2 | export const RAISE_ERROR = 'main.raise-error' 3 | export const CLEAR_NOTIFICATION_MESSAGES = 'main.clear-error' 4 | export const NOTIFY = 'main.notify' 5 | 6 | // Constants 7 | export const ERROR_MESSAGE = 'error' 8 | export const SUCCESS_MESSAGE = 'success' 9 | export const WARNING_MESSAGE = 'warning' 10 | export const COMMON_MESSAGE = 'common' 11 | -------------------------------------------------------------------------------- /resources/js/modules/setting/api/index.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | const API_ENDPOINT = 'settings' 4 | 5 | export default { 6 | 7 | update(model) { 8 | return axios.patch(API_ENDPOINT + '/profile', model) 9 | }, 10 | 11 | } 12 | -------------------------------------------------------------------------------- /resources/js/modules/setting/components/Profile.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 18 | 19 | 22 | -------------------------------------------------------------------------------- /resources/js/modules/setting/components/ProfileForm.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 103 | 104 | 118 | -------------------------------------------------------------------------------- /resources/js/modules/setting/routes.js: -------------------------------------------------------------------------------- 1 | import Profile from './components/Profile' 2 | 3 | export const routes = [ 4 | { 5 | path: '/profile', 6 | name: 'Profile', 7 | component: Profile, 8 | }, 9 | ] 10 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least eight characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have emailed your password reset link!', 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/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/sass/_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 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | @import "~element-ui/packages/theme-chalk/src/common/var"; 2 | @import url('https://fonts.googleapis.com/css?family=Nunito:200,600'); 3 | 4 | 5 | /* icon font path, required */ 6 | $--font-path: '~element-ui/lib/theme-chalk/fonts'; 7 | 8 | // Body 9 | $body-bg: #f8fafc; 10 | 11 | // Typography 12 | $font-family-sans-serif: 'Nunito', sans-serif; 13 | $font-size-base: 0.9rem; 14 | $line-height-base: 1.6; 15 | 16 | // Colors 17 | $blue: #3490dc; 18 | $indigo: #6574cd; 19 | $purple: #9561e2; 20 | $pink: #f66d9b; 21 | $red: #e3342f; 22 | $orange: #f6993f; 23 | $yellow: #ffed4a; 24 | $green: #38c172; 25 | $teal: #4dc0b5; 26 | $cyan: #6cb2eb; 27 | 28 | $color-primary: $blue; //#18c79c 29 | 30 | $--xs: 480px !default; 31 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Variables 2 | @import 'variables'; 3 | 4 | // Element-UI Theme 5 | @import "~element-ui/packages/theme-chalk/src/index"; 6 | 7 | // Font Awesome 8 | @import "~@fortawesome/fontawesome-free/scss/fontawesome.scss"; 9 | @import "~@fortawesome/fontawesome-free/scss/regular.scss"; 10 | @import "~@fortawesome/fontawesome-free/scss/solid.scss"; 11 | @import "~@fortawesome/fontawesome-free/scss/brands.scss"; 12 | 13 | // Custom Styles 14 | @import 'transitions'; 15 | @import 'style'; 16 | -------------------------------------------------------------------------------- /resources/sass/style.scss: -------------------------------------------------------------------------------- 1 | @import "variables"; 2 | 3 | body { 4 | font-family: $font-family-sans-serif; 5 | } 6 | 7 | .page-title { 8 | 9 | } 10 | 11 | .el-dialog { 12 | @media screen and (max-width: $--sm - 1) { 13 | width: 100% !important; 14 | border-radius: 0; 15 | } 16 | 17 | .el-dialog__header { 18 | padding-right: 35px; 19 | } 20 | 21 | @media (max-width: $--xs - 1) { 22 | .el-form-item__label { 23 | width: auto !important; 24 | } 25 | .el-form-item__content { 26 | clear: both; 27 | margin-left: 0 !important; 28 | } 29 | } 30 | } 31 | 32 | .text-center { 33 | text-align: center; 34 | margin: auto; 35 | } 36 | -------------------------------------------------------------------------------- /resources/views/spa.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{ config('app.name') }} 8 | 9 | 10 | 11 |
12 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /stubs/backEnd/controller.api.stub: -------------------------------------------------------------------------------- 1 | input('sortBy', 'id,asc')); 24 | $pageSize = (int) $request->input('pageSize', 10); 25 | 26 | $resource = DummySingular::query() 27 | ->when($request->filled('search'), function (Builder $q) use ($request) { 28 | $q->where(DummySingular::COLUMN_NAME, 'like', '%'.$request->search.'%'); 29 | }) 30 | ->orderBy($column, $order)->paginate($pageSize); 31 | 32 | return DummySingularResource::collection($resource); 33 | } 34 | 35 | /** 36 | * Store a newly created resource in storage. 37 | * @param DummySingularRequest $request 38 | * @return JsonResponse 39 | */ 40 | public function store(DummySingularRequest $request) 41 | { 42 | $data = $request->validated(); 43 | $dummyVariableSingular = new DummySingular($data); 44 | $dummyVariableSingular->save(); 45 | 46 | return response()->json([ 47 | 'type' => self::RESPONSE_TYPE_SUCCESS, 48 | 'message' => 'Successfully created', 49 | ]); 50 | } 51 | 52 | /** 53 | * Display the specified resource. 54 | * 55 | * @param DummySingular $dummyVariableSingular 56 | * @return DummySingularResource 57 | */ 58 | public function show(DummySingular $dummyVariableSingular) 59 | { 60 | return new DummySingularResource($dummyVariableSingular); 61 | } 62 | 63 | /** 64 | * Update the specified resource in storage. 65 | * 66 | * @param DummySingularRequest $request 67 | * @param DummySingular $dummyVariableSingular 68 | * @return JsonResponse 69 | */ 70 | public function update(DummySingularRequest $request, DummySingular $dummyVariableSingular) 71 | { 72 | $data = $request->validated(); 73 | $dummyVariableSingular->fill($data)->save(); 74 | 75 | return response()->json([ 76 | 'type' => self::RESPONSE_TYPE_SUCCESS, 77 | 'message' => 'Successfully updated', 78 | ]); 79 | } 80 | 81 | /** 82 | * @param DummySingular $dummyVariableSingular 83 | * @return JsonResponse 84 | * @throws Exception 85 | */ 86 | public function destroy(DummySingular $dummyVariableSingular) 87 | { 88 | $dummyVariableSingular->delete(); 89 | 90 | return response()->json([ 91 | 'type' => self::RESPONSE_TYPE_SUCCESS, 92 | 'message' => 'Successfully deleted', 93 | ]); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /stubs/backEnd/request.stub: -------------------------------------------------------------------------------- 1 | 'required|string', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /stubs/backEnd/resource.stub: -------------------------------------------------------------------------------- 1 | $this->faker->word, 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /stubs/frontEnd/api.stub: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | const API_ENDPOINT = 'dummyVariablePlural' 4 | 5 | export default { 6 | 7 | all(data) { 8 | return axios.get(API_ENDPOINT, {params: data}) 9 | }, 10 | 11 | find(id) { 12 | return axios.get(API_ENDPOINT + '/' + id) 13 | }, 14 | 15 | create(model) { 16 | return axios.post(API_ENDPOINT, model) 17 | }, 18 | 19 | update(model) { 20 | return axios.put(API_ENDPOINT + '/' + model.id, model) 21 | }, 22 | 23 | delete(id) { 24 | return axios.delete(API_ENDPOINT + '/' + id) 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /stubs/frontEnd/routes.stub: -------------------------------------------------------------------------------- 1 | import PageList from './components/DummySingularList' 2 | import PageView from './components/DummySingularView' 3 | 4 | export const routes = [ 5 | { 6 | path: '/dummyVariablePlural', 7 | name: 'DummyPlural', 8 | component: DummySingularList, 9 | }, 10 | { 11 | path: '/dummyVariablePlural/:id', 12 | name: 'Show DummySingular', 13 | component: DummySingularView, 14 | hidden: true 15 | }, 16 | ] 17 | -------------------------------------------------------------------------------- /stubs/frontEnd/store.actions.stub: -------------------------------------------------------------------------------- 1 | import * as types from './types' 2 | import dummyVariableSingularApi from '../api' 3 | 4 | export const actions = { 5 | async [types.DUMMY_VARIABLE_SINGULAR_FETCH]({commit}, data = null) { 6 | commit(types.DUMMY_VARIABLE_SINGULAR_SET_LOADING, true) 7 | const response = await dummyVariableSingularApi.all(data) 8 | commit(types.DUMMY_VARIABLE_SINGULAR_OBTAIN, response.data.data) 9 | commit(types.DUMMY_VARIABLE_SINGULAR_META, response.data.meta) 10 | commit(types.DUMMY_VARIABLE_SINGULAR_SET_LOADING, false) 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /stubs/frontEnd/store.stub: -------------------------------------------------------------------------------- 1 | import * as types from './types' 2 | import {actions} from './actions' 3 | 4 | export const store = { 5 | state: { 6 | dummyVariablePlural: [], 7 | dummyVariablePluralMeta: [], 8 | dummyVariablePluralLoading: true, 9 | }, 10 | getters: { 11 | dummyVariablePlural: state => state.dummyVariablePlural, 12 | dummyVariablePluralMeta: state => state.dummyVariablePluralMeta, 13 | dummyVariablePluralLoading: state => state.dummyVariablePluralLoading, 14 | }, 15 | mutations: { 16 | [types.DUMMY_VARIABLE_SINGULAR_OBTAIN](state, dummyVariablePlural) { 17 | state.dummyVariablePlural = dummyVariablePlural 18 | }, 19 | [types.DUMMY_VARIABLE_SINGULAR_CLEAR](state) { 20 | state.dummyVariablePlural = [] 21 | }, 22 | [types.DUMMY_VARIABLE_SINGULAR_SET_LOADING](state, loading) { 23 | state.dummyVariablePluralLoading = loading 24 | }, 25 | [types.DUMMY_VARIABLE_SINGULAR_META](state, meta) { 26 | state.dummyVariablePluralMeta = meta 27 | }, 28 | }, 29 | actions 30 | } 31 | -------------------------------------------------------------------------------- /stubs/frontEnd/store.types.stub: -------------------------------------------------------------------------------- 1 | // Actions 2 | export const DUMMY_VARIABLE_SINGULAR_FETCH = '[DummySingular] Fetch' 3 | 4 | // Mutations 5 | export const DUMMY_VARIABLE_SINGULAR_META = '[DummySingular] meta' 6 | export const DUMMY_VARIABLE_SINGULAR_OBTAIN = '[DummySingular] obtain' 7 | export const DUMMY_VARIABLE_SINGULAR_CLEAR = '[DummySingular] clear' 8 | export const DUMMY_VARIABLE_SINGULAR_SET_LOADING = '[DummySingular] set loading' 9 | -------------------------------------------------------------------------------- /stubs/frontEnd/vue.form.stub: -------------------------------------------------------------------------------- 1 | 45 | 46 | 114 | -------------------------------------------------------------------------------- /stubs/frontEnd/vue.view.stub: -------------------------------------------------------------------------------- 1 | 8 | 9 | 31 | -------------------------------------------------------------------------------- /stubs/migration.create.stub: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('{{ table }}'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /stubs/model.stub: -------------------------------------------------------------------------------- 1 | user = User::factory()->create(); 20 | } 21 | 22 | /** @test */ 23 | public function create_dummyVariableSingular() 24 | { 25 | $this->actingAs($this->user) 26 | ->postJson(route('dummyVariablePlural.store'), [ 27 | 'name' => 'Lorem', 28 | ]) 29 | ->assertSuccessful() 30 | ->assertJson(['type' => Controller::RESPONSE_TYPE_SUCCESS]); 31 | 32 | $this->assertDatabaseHas('dummyVariablePlural', [ 33 | 'name' => 'Lorem', 34 | ]); 35 | } 36 | 37 | /** @test */ 38 | public function update_dummyVariableSingular() 39 | { 40 | $dummyVariableSingular = DummySingular::factory()->create(); 41 | 42 | $this->actingAs($this->user) 43 | ->putJson(route('dummyVariablePlural.update', $dummyVariableSingular->id), [ 44 | 'name' => 'Updated dummyVariableSingular', 45 | ]) 46 | ->assertSuccessful() 47 | ->assertJson(['type' => Controller::RESPONSE_TYPE_SUCCESS]); 48 | 49 | $this->assertDatabaseHas('dummyVariablePlural', [ 50 | 'id' => $dummyVariableSingular->id, 51 | 'name' => 'Updated dummyVariableSingular', 52 | ]); 53 | } 54 | 55 | /** @test */ 56 | public function show_dummyVariableSingular() 57 | { 58 | $dummyVariableSingular = DummySingular::factory()->create(); 59 | 60 | $this->actingAs($this->user) 61 | ->getJson(route('dummyVariablePlural.show', $dummyVariableSingular->id)) 62 | ->assertSuccessful() 63 | ->assertJson([ 64 | 'data' => [ 65 | 'name' => $dummyVariableSingular->name, 66 | ], 67 | ]); 68 | } 69 | 70 | /** @test */ 71 | public function list_dummyVariableSingular() 72 | { 73 | $dummyVariablePlural = DummySingular::factory()->count(2)->create()->map(function ($dummyVariableSingular) { 74 | return $dummyVariableSingular->only(['id', 'name']); 75 | }); 76 | 77 | $this->actingAs($this->user) 78 | ->getJson(route('dummyVariablePlural.index')) 79 | ->assertSuccessful() 80 | ->assertJson([ 81 | 'data' => $dummyVariablePlural->toArray(), 82 | ]) 83 | ->assertJsonStructure([ 84 | 'data' => [ 85 | '*' => ['id', 'name'], 86 | ], 87 | 'links', 88 | 'meta', 89 | ]); 90 | } 91 | 92 | /** @test */ 93 | public function delete_dummyVariableSingular() 94 | { 95 | $dummyVariableSingular = DummySingular::factory()->create([ 96 | 'name' => 'DummySingular for delete', 97 | ]); 98 | 99 | $this->actingAs($this->user) 100 | ->deleteJson(route('dummyVariablePlural.update', $dummyVariableSingular->id)) 101 | ->assertSuccessful() 102 | ->assertJson(['type' => Controller::RESPONSE_TYPE_SUCCESS]); 103 | 104 | $this->assertDatabaseMissing('dummyVariablePlural', [ 105 | 'id' => $dummyVariableSingular->id, 106 | 'name' => 'DummySingular for delete', 107 | ]); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 20 | 21 | return $app; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Feature/LoginTest.php: -------------------------------------------------------------------------------- 1 | user = User::factory()->create(); 20 | } 21 | 22 | /** @test */ 23 | public function authenticate() 24 | { 25 | $response = $this->postJson(route('login'), [ 26 | 'email' => $this->user->email, 27 | 'password' => 'password', 28 | 'device_name' => 'spa', 29 | ]); 30 | 31 | $token = $response->json()['token']; 32 | 33 | $response 34 | ->assertSuccessful() 35 | ->assertJson(['token' => $token]) 36 | ->assertHeader('Authorization'); 37 | 38 | $this->withToken($token) 39 | ->postJson(route('me')) 40 | ->assertSuccessful(); 41 | 42 | $this->assertDatabaseHas(PersonalAccessToken::TABLE_NAME, [ 43 | PersonalAccessToken::COLUMN_NAME => 'spa', 44 | PersonalAccessToken::COLUMN_TOKENABLE_ID => $this->user->id, 45 | PersonalAccessToken::COLUMN_TOKENABLE_TYPE => User::class, 46 | ]); 47 | } 48 | 49 | /** @test */ 50 | public function fetch_the_current_user() 51 | { 52 | $this->actingAs($this->user) 53 | ->postJson(route('me')) 54 | ->assertSuccessful() 55 | ->assertJsonPath('data.email', $this->user->email); 56 | } 57 | 58 | /** @test */ 59 | public function log_out() 60 | { 61 | Config::set('auth.defaults.guard', 'api'); 62 | 63 | $response = $this->postJson(route('login'), [ 64 | 'email' => $this->user->email, 65 | 'password' => 'password', 66 | 'device_name' => 'spa', 67 | ]); 68 | 69 | $token = $response->json()['token']; 70 | 71 | $this->withToken($token) 72 | ->postJson(route('logout')) 73 | ->assertOk(); 74 | 75 | $this->assertDatabaseMissing(PersonalAccessToken::TABLE_NAME, [ 76 | PersonalAccessToken::COLUMN_NAME => 'spa', 77 | PersonalAccessToken::COLUMN_TOKENABLE_ID => $this->user->id, 78 | PersonalAccessToken::COLUMN_TOKENABLE_TYPE => User::class, 79 | ]); 80 | 81 | $this->withToken($token) 82 | ->postJson(route('me')) 83 | ->assertStatus(401); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /tests/Feature/RegisterTest.php: -------------------------------------------------------------------------------- 1 | postJson(route('register'), [ 15 | User::COLUMN_NAME => 'Test User', 16 | User::COLUMN_EMAIL => 'test@test.app', 17 | User::COLUMN_PASSWORD => 'Pa$$w0rd', 18 | 'password_confirmation' => 'Pa$$w0rd', 19 | ]) 20 | ->assertSuccessful(); 21 | 22 | if (new User instanceof MustVerifyEmail) { 23 | $response->assertJson(['status' => 'We have e-mailed your verification link!']); 24 | } else { 25 | $response->assertJsonStructure(['id', 'name', 'email']); 26 | } 27 | 28 | $this->assertDatabaseHas('users', [ 29 | User::COLUMN_NAME => 'Test User', 30 | User::COLUMN_EMAIL => 'test@test.app', 31 | ]); 32 | } 33 | 34 | /** @test */ 35 | public function can_not_register_with_existing_email() 36 | { 37 | User::factory()->create(['email' => 'test@test.app']); 38 | 39 | $this->postJson(route('register'), [ 40 | 'name' => 'Test User', 41 | 'email' => 'test@test.app', 42 | 'password' => 'secret', 43 | 'password_confirmation' => 'secret', 44 | ]) 45 | ->assertStatus(422) 46 | ->assertJsonValidationErrors(['email']); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/Feature/SettingsTest.php: -------------------------------------------------------------------------------- 1 | user = User::factory()->create(); 19 | } 20 | 21 | /** @test */ 22 | public function update_profile_info() 23 | { 24 | $this->actingAs($this->user) 25 | ->patchJson(route('profile.update'), [ 26 | 'name' => 'Test User', 27 | 'email' => 'test@test.app', 28 | ]) 29 | ->assertSuccessful() 30 | ->assertJson(['type' => Controller::RESPONSE_TYPE_SUCCESS]); 31 | 32 | $this->assertDatabaseHas('users', [ 33 | 'id' => $this->user->id, 34 | 'name' => 'Test User', 35 | 'email' => 'test@test.app', 36 | ]); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /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(route('verification.verify', ['user' => $user])) 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(route('verification.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(route('verification.resend', ['email' => 'not_existed_email@app.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(route('verification.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 | user = User::factory()->create(); 24 | } 25 | 26 | public function actingAs(Authenticatable $user, $driver = null) 27 | { 28 | Sanctum::actingAs($user); 29 | 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Webpack config 6 | |-------------------------------------------------------------------------- 7 | | 8 | | To set PHPStorm see https://gist.github.com/nachodd/4e120492a5ddd56360e8cff9595753ae 9 | | 10 | */ 11 | 12 | module.exports = { 13 | output: { 14 | chunkFilename: 'js/chunks/[name].js', 15 | }, 16 | resolve: { 17 | extensions: ['.js', '.json', '.vue'], 18 | alias: { 19 | '@': path.resolve('./resources/js'), 20 | } 21 | }, 22 | } 23 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | const config = require('./webpack.config') 3 | 4 | /* 5 | |-------------------------------------------------------------------------- 6 | | Mix Asset Management 7 | |-------------------------------------------------------------------------- 8 | | 9 | | Mix provides a clean, fluent API for defining some Webpack build steps 10 | | for your Laravel application. By default, we are compiling the Sass 11 | | file for the application as well as bundling up all the JS files. 12 | | 13 | */ 14 | 15 | mix.js('resources/js/app.js', 'public/js') 16 | .sass('resources/sass/app.scss', 'public/css') 17 | .vue({ version: 2 }); 18 | 19 | mix.autoload({ 20 | lodash: ['_'], 21 | }) 22 | 23 | if (mix.inProduction()) { 24 | mix.version() 25 | } else { 26 | mix.sourceMaps(true, 'source-map') 27 | } 28 | 29 | mix.options({ 30 | fileLoaderDirs: { 31 | images: 'images/compiled', 32 | fonts: 'fonts' 33 | } 34 | }) 35 | 36 | if (process.env.sync) { 37 | mix.browserSync({ 38 | proxy: '127.0.0.1:8000' 39 | }) 40 | } 41 | 42 | mix.webpackConfig(config) 43 | --------------------------------------------------------------------------------