├── .editorconfig ├── .env.docs ├── .env.example ├── .gitattributes ├── .gitignore ├── README.md ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── data.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── query-builder.php ├── queue.php ├── scribe.php ├── services.php ├── session.php ├── telescope.php └── view.php ├── database ├── .gitignore ├── factories │ └── Client │ │ └── UserFactory.php ├── migrations │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ └── Client │ │ ├── 2014_10_12_000000_create_users_table.php │ │ └── 2014_10_12_100000_create_password_reset_tokens_table.php └── seeders │ ├── Client │ └── UserSeeder.php │ ├── DatabaseSeeder.php │ └── TestingSeeder.php ├── docker-compose.yml ├── grumphp.yml ├── package.json ├── phpunit.xml ├── pint.json ├── public ├── .htaccess ├── favicon.ico ├── index.php ├── robots.txt └── vendor │ └── telescope │ ├── app-dark.css │ ├── app.css │ ├── app.js │ ├── favicon.ico │ └── mix-manifest.json ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── src ├── app │ ├── Application.php │ ├── Console │ │ └── Kernel.php │ ├── Exceptions │ │ └── Handler.php │ ├── Helpers │ │ └── DocStrategies │ │ │ ├── ApiResponseTags.php │ │ │ └── HasPaginationParameters.php │ ├── Http │ │ ├── Controllers │ │ │ └── Controller.php │ │ ├── Kernel.php │ │ └── Middleware │ │ │ ├── Authenticate.php │ │ │ ├── EncryptCookies.php │ │ │ ├── PreventRequestsDuringMaintenance.php │ │ │ ├── RedirectIfAuthenticated.php │ │ │ ├── SetAcceptJsonHeader.php │ │ │ ├── SetLocalLanguage.php │ │ │ ├── SetLogContext.php │ │ │ ├── TrimStrings.php │ │ │ ├── TrustHosts.php │ │ │ ├── TrustProxies.php │ │ │ ├── ValidateSignature.php │ │ │ └── VerifyCsrfToken.php │ ├── Providers │ │ ├── AppServiceProvider.php │ │ ├── AuthServiceProvider.php │ │ ├── BroadcastServiceProvider.php │ │ ├── EventServiceProvider.php │ │ ├── RouteServiceProvider.php │ │ └── TelescopeServiceProvider.php │ └── Traits │ │ └── ApiResponseHelper.php ├── domain │ └── Client │ │ └── Models │ │ └── User.php └── shared │ ├── Enums │ └── MorphEnum.php │ └── Helpers │ └── global.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── Pest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── vite.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.docs: -------------------------------------------------------------------------------- 1 | APP_DEBUG=false 2 | DB_DATABASE=sqlite 3 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=example_app 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailpit 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 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 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | 60 | #TELESCOPE_ENABLED=true 61 | 62 | # Sail related keys 63 | 64 | #SAIL_XDEBUG_MODE=develop,debug,coverage 65 | 66 | #APP_PORT=80 67 | #VITE_PORT=5173 68 | #FORWARD_DB_PORT=3306 69 | #FORWARD_REDIS_PORT=6379 70 | #FORWARD_MEILISEARCH_PORT=7700 71 | #FORWARD_MAILPIT_PORT=1025 72 | #FORWARD_MAILPIT_DASHBOARD_PORT=8025 73 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | /vendor 8 | .env 9 | .env.backup 10 | .env.production 11 | .phpunit.result.cache 12 | Homestead.json 13 | Homestead.yaml 14 | auth.json 15 | npm-debug.log 16 | yarn-error.log 17 | /.fleet 18 | /.idea 19 | /.vscode 20 | _ide_helper.php 21 | _ide_helper_models.php 22 | .phpstorm.meta.php 23 | /.scribe 24 | /public/docs -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Laravel API Boilerplate 3 |

4 |

5 | A Laravel project with a Domain-Driven Design (DDD) structure, basic configuration, and commonly used packages pre-installed and configured, to help you start building your next big application. 6 |

7 | 8 | # Requirements 9 | - PHP ^8.1 10 | - Composer ^2.2 11 | 12 | # Installation 13 | ```bash 14 | composer create-project abd-wazzan/laravel-api-boilerplate api-app 15 | ``` 16 | Install dependencies 17 | ```bash 18 | cd api-app 19 | composer install 20 | ``` 21 | Setup .env file 22 | ```bash 23 | cp .env.example .env 24 | ``` 25 | Generate the application key 26 | ```bash 27 | php artisan key:generate 28 | ``` 29 | Run Locally 30 | ```bash 31 | php artisan serve 32 | ``` 33 | # Installed Packages 34 | 35 | General: 36 | - [Passport](https://laravel.com/docs/10.x/passport) 37 | - [Laravel Actions](https://laravelactions.com) 38 | - [Laravel Data](https://spatie.be/docs/laravel-data/v3/introduction) 39 | - [Laravel Query Builder](https://spatie.be/index.php/docs/laravel-query-builder/v5/introduction) 40 | 41 | Development: 42 | - [Laravel IDE Helper](https://github.com/barryvdh/laravel-ide-helper) 43 | - [Scribe API documentation tool](https://scribe.knuckles.wtf/laravel) 44 | - [Laravel Telescope](https://laravel.com/docs/10.x/telescope) 45 | - [Pest Testing Framework](https://pestphp.com/) 46 | - [Grum PHP](https://github.com/phpro/grumphp) 47 | - [Security Advisor](https://github.com/Roave/SecurityAdvisories) 48 | 49 | # Features 50 | - [DDD (Domain Driven Design)](#ddd) 51 | - [API Response Helper](#api-response-helper) 52 | - [Scribe Api Tags](#scribe-api-tags) 53 | - [Global Helper](#global-helper) 54 | - [Migration Structure](#migration-structure) 55 | - [Polymorphic Mapping](#polymorphic-mapping) 56 | - [Database Seeders](#database-seeders) 57 | - [Shared Directory](#shared-directory) 58 | - [Enable Model Strict Mode](https://laravel.com/docs/10.x/eloquent#configuring-eloquent-strictness) 59 | - [Pest testing framework](https://pestphp.com/docs/installation) 60 | 61 | ## DDD 62 | Software development approach that tries to bring the business language and the source code as close as possible. 63 | 64 | This structure is inspired by [LARAVEL BEYOND CRUD](https://laravel-beyond-crud.com/). 65 | 66 | ### Files Structure 67 | Domain Layer Example: 68 | 69 | src/Domain/Invoices/ 70 | ├── Actions 71 | ├── QueryBuilders 72 | ├── Collections 73 | ├── Data 74 | ├── Events 75 | ├── Exceptions 76 | ├── Listeners 77 | ├── Models 78 | ├── Rules 79 | └── States 80 | src/Domain/Products/ 81 | ├── Actions 82 | └── ..... 83 | 84 | Application Layer Example: 85 | 86 | The REST API application: 87 | src/App/Api/ 88 | ├── Products 89 | ├── Controllers 90 | ├── Middlewares 91 | ├── Requests 92 | ├── Queries 93 | ├── Filters 94 | └── Resources 95 | 96 | The Console application 97 | src/App/Console/ 98 | └── Commands 99 | 100 | The admin HTTP application: 101 | src/App/Admin/ 102 | ├── Products 103 | ├── Controllers 104 | ├── Middlewares 105 | ├── Requests 106 | ├── Resources 107 | ├── Queries 108 | ├── Filters 109 | └── ViewModels 110 | 111 | ### Dependency Illustration 112 | [![](https://mermaid.ink/img/pako:eNptkV9PwjAUxb9KcxMSTAZh_xjswQRWfJKggC8yHup2lcVtnV2XiJTvbulEMPGtved3em7vPUDCU4QQ3gSrdmRN45IQMtk81Si2pNe7VUv8aLCWiky7ES-l4HmOgkwSmfHyxtBTw9H1QpGoS3nBsvKPHhn9gQlWoEShCO3OdWjeqvSkErV6vCd1IrJKJ802lEn2wmrcGmTWIo8Nij0RWDe5hui1e_lTjC6BRC0qFOzUxq9neunXeCpe1qjI5NrV_sNUOp0ze4cy2RHTgKJnjf7Tlk4ACwoUegqpHuvhBMcgd1hgDKE-pky8xxCXR82xRvLVvkwglKJBC5oqZRJpxvQ2CghfWV7rKqaZ5GLe7smsy4KKlc-cF2ejvkJ4gE8IHc_v-844GNuuZ49tx3Yt2EM4CvqeF7gjNxgNfN-xg6MFX-aBQX_oBY4_9H3XDtzB0HeO333zodw?type=png)](https://mermaid.live/edit#pako:eNptkV9PwjAUxb9KcxMSTAZh_xjswQRWfJKggC8yHup2lcVtnV2XiJTvbulEMPGtved3em7vPUDCU4QQ3gSrdmRN45IQMtk81Si2pNe7VUv8aLCWiky7ES-l4HmOgkwSmfHyxtBTw9H1QpGoS3nBsvKPHhn9gQlWoEShCO3OdWjeqvSkErV6vCd1IrJKJ802lEn2wmrcGmTWIo8Nij0RWDe5hui1e_lTjC6BRC0qFOzUxq9neunXeCpe1qjI5NrV_sNUOp0ze4cy2RHTgKJnjf7Tlk4ACwoUegqpHuvhBMcgd1hgDKE-pky8xxCXR82xRvLVvkwglKJBC5oqZRJpxvQ2CghfWV7rKqaZ5GLe7smsy4KKlc-cF2ejvkJ4gE8IHc_v-844GNuuZ49tx3Yt2EM4CvqeF7gjNxgNfN-xg6MFX-aBQX_oBY4_9H3XDtzB0HeO333zodw) 113 | 114 | ### Resources 115 | - [Domain Oriented Laravel](https://stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel) 116 | - [Working With Data](https://stitcher.io/blog/laravel-beyond-crud-02-working-with-data) 117 | - [Actions](https://stitcher.io/blog/laravel-beyond-crud-03-actions) 118 | - [Models](https://stitcher.io/blog/laravel-beyond-crud-04-models) 119 | - [States](https://stitcher.io/blog/laravel-beyond-crud-05-states) 120 | - [Managing Domains](https://stitcher.io/blog/laravel-beyond-crud-06-managing-domains) 121 | - [Application Layer](https://stitcher.io/blog/laravel-beyond-crud-07-entering-the-application-layer) 122 | - [View Models](https://stitcher.io/blog/laravel-beyond-crud-08-view-models) 123 | - [Test Factories](https://stitcher.io/blog/laravel-beyond-crud-09-test-factories) 124 | 125 | ## API Response Helper 126 | A simple trait allowing consistent API responses throughout your Laravel application. 127 | 128 | ### Available methods: 129 | | Method | Status | 130 | |:--------------------------|:-------| 131 | | `okResponse()` | `200` | 132 | | `createdResponse()` | `201` | 133 | | `failedResponse()` | `400` | 134 | | `unauthorizedResponse()` | `401` | 135 | | `forbiddenResponse()` | `403` | 136 | | `notFoundResponse()` | `404` | 137 | | `unprocessableResponse()` | `422` | 138 | | `serverErrorResponse()` | `500` | 139 | 140 | ### Usages Example: 141 | ```php 142 | okResponse(); 157 | } 158 | } 159 | ``` 160 | ## Scribe Api Tags 161 | Additional scribe tags that match the ApiResponseHelper responses. 162 | 163 | ### Available Response tags: 164 | | Tag | Status | 165 | |:-------------------------|:-------| 166 | | `@okResponse` | `200` | 167 | | `@createdResponse` | `201` | 168 | | `@failedResponse` | `400` | 169 | | `@unauthorizedResponse` | `401` | 170 | | `@forbiddenResponse` | `403` | 171 | | `@notFoundResponse` | `404` | 172 | | `@unprocessableResponse` | `422` | 173 | | `@serverErrorResponse` | `500` | 174 | 175 | ### Other Available tag: 176 | | Tag | Description | 177 | |:------------------|:-----------------------------------------------------------------| 178 | | `@usesPagination` | will add `page[number]` and `page[size]` to the query parameters | 179 | 180 | ### Usages Example: 181 | ```php 182 | all()); 215 | } 216 | 217 | } 218 | ``` 219 | 220 | ## Global Helper 221 | Simple php file that contains you global functions, which you can find it in `./src/shared/Helpers/global.php`. 222 | 223 | ## Migration Structure 224 | In order to group your migration files by their domains, you can create additional migration directories 225 | and load them in the `AppServiceProvider` using `loadMigrationsFrom` function: 226 | 227 | ```php 228 | loadMigrationsFrom([ 239 | database_path().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR.'Client', 240 | ]); 241 | } 242 | } 243 | ``` 244 | 245 | ## Polymorphic Mapping 246 | Please read this [article](https://laravel-news.com/enforcing-morph-maps-in-laravel) first to identify the problem. 247 | 248 | In order to achieve the morph mapping, we created the `MorphEnum` that will contain each model morph key and then use it 249 | in `Relation::morphMap` function as shown in the example: 250 | ```php 251 | value => User::class, 276 | ]); 277 | } 278 | } 279 | ``` 280 | 281 | ## Database Seeders 282 | We generally have two types of seeded data: 283 | 284 | - Initial data: the project cannot function without it. For example, countries table data, and these data usually come 285 | from datasets. 286 | - Fake data: for testing purposes that can fill up any table instead of manually inserting row by row, this data is 287 | usually generated by factories. 288 | 289 | In order to prevent the fake data from being seeded in the production environment, we created a new seeder class 290 | called `TestingSeeder.php` which will contain all the fake data seeders and will only run in a non-production 291 | environment. The normal seeders will stay in `DatabaseSeeder.php`. 292 | 293 | ## Shared Directory 294 | The `src/shared/` directory is used for helper, traits, enums .... that are going to be used by the application and the domain. 295 | 296 | # Feedback 297 | I will be happy to hear your feedback! If you have any recommendation or suggestion, please send an e-mail 298 | to [Mail](mailto:abdulrahmanwazzan.pro@gmail.com). 299 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | useAppPath(dirname(__DIR__) . '/src/app'); 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Bind Important Interfaces 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Next, we need to bind some important interfaces into the container so 24 | | we will be able to resolve them when needed. The kernels serve the 25 | | incoming requests to this application from both the web and CLI. 26 | | 27 | */ 28 | 29 | $app->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": "abd-wazzan/laravel-api-boilerplate", 3 | "type": "project", 4 | "description": "A Laravel project with a Domain-Driven Design (DDD) structure, basic configuration, and commonly used packages pre-installed, directed towards building APIs.", 5 | "keywords": ["boilerplate", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.1", 9 | "guzzlehttp/guzzle": "^7.5", 10 | "laravel/framework": "^10.4", 11 | "laravel/passport": "^11.8", 12 | "laravel/tinker": "^2.8", 13 | "lorisleiva/laravel-actions": "^2.5", 14 | "spatie/laravel-data": "^3.2", 15 | "spatie/laravel-query-builder": "^5.2" 16 | }, 17 | "require-dev": { 18 | "barryvdh/laravel-ide-helper": "^2.13", 19 | "fakerphp/faker": "^1.21.0", 20 | "knuckleswtf/scribe": "^4.17", 21 | "laravel/pint": "^1.7", 22 | "laravel/sail": "^1.21", 23 | "laravel/telescope": "^4.14", 24 | "mockery/mockery": "^1.5.1", 25 | "nunomaduro/collision": "^7.3", 26 | "pestphp/pest": "^2.2", 27 | "pestphp/pest-plugin-laravel": "^2.0", 28 | "phpro/grumphp": "^1.15", 29 | "roave/security-advisories": "dev-latest", 30 | "spatie/laravel-ignition": "^2.0" 31 | }, 32 | "autoload": { 33 | "psr-4": { 34 | "App\\": "src/app/", 35 | "Domain\\": "src/domain/", 36 | "Shared\\": "src/shared/", 37 | "Database\\Factories\\": "database/factories/", 38 | "Database\\Seeders\\": "database/seeders/" 39 | }, 40 | "files": [ 41 | "src/shared/Helpers/global.php" 42 | ] 43 | }, 44 | "autoload-dev": { 45 | "psr-4": { 46 | "Tests\\": "tests/" 47 | } 48 | }, 49 | "scripts": { 50 | "post-autoload-dump": [ 51 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 52 | "@php artisan package:discover --ansi" 53 | ], 54 | "post-update-cmd": [ 55 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force", 56 | "@php artisan ide-helper:generate", 57 | "@php artisan ide-helper:meta" 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 | }, 66 | "extra": { 67 | "laravel": { 68 | "dont-discover": [ 69 | "barryvdh/laravel-ide-helper", 70 | "laravel/telescope" 71 | ] 72 | } 73 | }, 74 | "config": { 75 | "optimize-autoloader": true, 76 | "preferred-install": "dist", 77 | "sort-packages": true, 78 | "allow-plugins": { 79 | "pestphp/pest-plugin": true, 80 | "php-http/discovery": true, 81 | "phpro/grumphp": true 82 | } 83 | }, 84 | "minimum-stability": "stable", 85 | "prefer-stable": true 86 | } 87 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'Laravel'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Application Environment 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This value determines the "environment" your application is currently 26 | | running in. This may determine how you prefer to configure various 27 | | services the application utilizes. Set this in your ".env" file. 28 | | 29 | */ 30 | 31 | 'env' => env('APP_ENV', 'production'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Application Debug Mode 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When your application is in debug mode, detailed error messages with 39 | | stack traces will be shown on every error that occurs within your 40 | | application. If disabled, a simple generic error page is shown. 41 | | 42 | */ 43 | 44 | 'debug' => (bool) env('APP_DEBUG', false), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Application URL 49 | |-------------------------------------------------------------------------- 50 | | 51 | | This URL is used by the console to properly generate URLs when using 52 | | the Artisan command line tool. You should set this to the root of 53 | | your application so that it is used when running Artisan tasks. 54 | | 55 | */ 56 | 57 | 'url' => env('APP_URL', 'http://localhost'), 58 | 59 | 'asset_url' => env('ASSET_URL'), 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Application Timezone 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may specify the default timezone for your application, which 67 | | will be used by the PHP date and date-time functions. We have gone 68 | | ahead and set this to a sensible default for you out of the box. 69 | | 70 | */ 71 | 72 | 'timezone' => 'UTC', 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Application Locale Configuration 77 | |-------------------------------------------------------------------------- 78 | | 79 | | The application locale determines the default locale that will be used 80 | | by the translation service provider. You are free to set this value 81 | | to any of the locales which will be supported by the application. 82 | | 83 | */ 84 | 85 | 'locale' => 'en', 86 | 87 | /* 88 | |-------------------------------------------------------------------------- 89 | | Application Fallback Locale 90 | |-------------------------------------------------------------------------- 91 | | 92 | | The fallback locale determines the locale to use when the current one 93 | | is not available. You may change the value to correspond to any of 94 | | the language folders that are provided through your application. 95 | | 96 | */ 97 | 98 | 'fallback_locale' => 'en', 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Faker Locale 103 | |-------------------------------------------------------------------------- 104 | | 105 | | This locale will be used by the Faker PHP library when generating fake 106 | | data for your database seeds. For example, this will be used to get 107 | | localized telephone numbers, street address information and more. 108 | | 109 | */ 110 | 111 | 'faker_locale' => 'en_US', 112 | 113 | /* 114 | |-------------------------------------------------------------------------- 115 | | Encryption Key 116 | |-------------------------------------------------------------------------- 117 | | 118 | | This key is used by the Illuminate encrypter service and should be set 119 | | to a random, 32 character string, otherwise these encrypted strings 120 | | will not be safe. Please do this before deploying an application! 121 | | 122 | */ 123 | 124 | 'key' => env('APP_KEY'), 125 | 126 | 'cipher' => 'AES-256-CBC', 127 | 128 | /* 129 | |-------------------------------------------------------------------------- 130 | | Maintenance Mode Driver 131 | |-------------------------------------------------------------------------- 132 | | 133 | | These configuration options determine the driver used to determine and 134 | | manage Laravel's "maintenance mode" status. The "cache" driver will 135 | | allow maintenance mode to be controlled across multiple machines. 136 | | 137 | | Supported drivers: "file", "cache" 138 | | 139 | */ 140 | 141 | 'maintenance' => [ 142 | 'driver' => 'file', 143 | // 'store' => 'redis', 144 | ], 145 | 146 | /* 147 | |-------------------------------------------------------------------------- 148 | | Autoloaded Service Providers 149 | |-------------------------------------------------------------------------- 150 | | 151 | | The service providers listed here will be automatically loaded on the 152 | | request to your application. Feel free to add your own services to 153 | | this array to grant expanded functionality to your applications. 154 | | 155 | */ 156 | 157 | 'providers' => [ 158 | 159 | /* 160 | * Laravel Framework Service Providers... 161 | */ 162 | Illuminate\Auth\AuthServiceProvider::class, 163 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 164 | Illuminate\Bus\BusServiceProvider::class, 165 | Illuminate\Cache\CacheServiceProvider::class, 166 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 167 | Illuminate\Cookie\CookieServiceProvider::class, 168 | Illuminate\Database\DatabaseServiceProvider::class, 169 | Illuminate\Encryption\EncryptionServiceProvider::class, 170 | Illuminate\Filesystem\FilesystemServiceProvider::class, 171 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 172 | Illuminate\Hashing\HashServiceProvider::class, 173 | Illuminate\Mail\MailServiceProvider::class, 174 | Illuminate\Notifications\NotificationServiceProvider::class, 175 | Illuminate\Pagination\PaginationServiceProvider::class, 176 | Illuminate\Pipeline\PipelineServiceProvider::class, 177 | Illuminate\Queue\QueueServiceProvider::class, 178 | Illuminate\Redis\RedisServiceProvider::class, 179 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 180 | Illuminate\Session\SessionServiceProvider::class, 181 | Illuminate\Translation\TranslationServiceProvider::class, 182 | Illuminate\Validation\ValidationServiceProvider::class, 183 | Illuminate\View\ViewServiceProvider::class, 184 | 185 | /* 186 | * Package Service Providers... 187 | */ 188 | 189 | /* 190 | * Application Service Providers... 191 | */ 192 | App\Providers\AppServiceProvider::class, 193 | App\Providers\AuthServiceProvider::class, 194 | // App\Providers\BroadcastServiceProvider::class, 195 | App\Providers\EventServiceProvider::class, 196 | App\Providers\RouteServiceProvider::class, 197 | 198 | ], 199 | 200 | /* 201 | |-------------------------------------------------------------------------- 202 | | Class Aliases 203 | |-------------------------------------------------------------------------- 204 | | 205 | | This array of class aliases will be registered when this application 206 | | is started. However, feel free to register as many as you wish as 207 | | the aliases are "lazy" loaded so they don't hinder performance. 208 | | 209 | */ 210 | 211 | 'aliases' => Facade::defaultAliases()->merge([ 212 | // 'ExampleClass' => App\Example\ExampleClass::class, 213 | ])->toArray(), 214 | 215 | ]; 216 | -------------------------------------------------------------------------------- /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" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 'api' => [ 44 | 'driver' => 'passport', 45 | 'provider' => 'users', 46 | ], 47 | ], 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | User Providers 52 | |-------------------------------------------------------------------------- 53 | | 54 | | All authentication drivers have a user provider. This defines how the 55 | | users are actually retrieved out of your database or other storage 56 | | mechanisms used by this application to persist your user's data. 57 | | 58 | | If you have multiple user tables or models you may configure multiple 59 | | sources which represent each model / table. These sources may then 60 | | be assigned to any extra authentication guards you have defined. 61 | | 62 | | Supported: "database", "eloquent" 63 | | 64 | */ 65 | 66 | 'providers' => [ 67 | 'users' => [ 68 | 'driver' => 'eloquent', 69 | 'model' => \Domain\Client\Models\User::class, 70 | ], 71 | 72 | // 'users' => [ 73 | // 'driver' => 'database', 74 | // 'table' => 'users', 75 | // ], 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Resetting Passwords 81 | |-------------------------------------------------------------------------- 82 | | 83 | | You may specify multiple password reset configurations if you have more 84 | | than one user table or model in the application and you want to have 85 | | separate password reset settings based on the specific user types. 86 | | 87 | | The expiry time is the number of minutes that each reset token will be 88 | | considered valid. This security feature keeps tokens short-lived so 89 | | they have less time to be guessed. You may change this as needed. 90 | | 91 | | The throttle setting is the number of seconds a user must wait before 92 | | generating more password reset tokens. This prevents the user from 93 | | quickly generating a very large amount of password reset tokens. 94 | | 95 | */ 96 | 97 | 'passwords' => [ 98 | 'users' => [ 99 | 'provider' => 'users', 100 | 'table' => 'password_reset_tokens', 101 | 'expire' => 60, 102 | 'throttle' => 60, 103 | ], 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Password Confirmation Timeout 109 | |-------------------------------------------------------------------------- 110 | | 111 | | Here you may define the amount of seconds before a password confirmation 112 | | times out and the user is prompted to re-enter their password via the 113 | | confirmation screen. By default, the timeout lasts for three hours. 114 | | 115 | */ 116 | 117 | 'password_timeout' => 10800, 118 | 119 | ]; 120 | -------------------------------------------------------------------------------- /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 | 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => 'https' === env('PUSHER_SCHEME', 'https'), 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/data.php: -------------------------------------------------------------------------------- 1 | [DATE_ATOM, "Y-m-d H:i", "Y-m-d H", "Y-m-d"], 10 | 11 | /* 12 | * Global transformers will take complex types and transform them into simple 13 | * types. 14 | */ 15 | 'transformers' => [ 16 | DateTimeInterface::class => \Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer::class, 17 | \Illuminate\Contracts\Support\Arrayable::class => \Spatie\LaravelData\Transformers\ArrayableTransformer::class, 18 | BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class, 19 | ], 20 | 21 | /* 22 | * Global casts will cast values into complex types when creating a data 23 | * object from simple types. 24 | */ 25 | 'casts' => [ 26 | DateTimeInterface::class => Spatie\LaravelData\Casts\DateTimeInterfaceCast::class, 27 | BackedEnum::class => Spatie\LaravelData\Casts\EnumCast::class, 28 | ], 29 | 30 | /* 31 | * Rule inferrers can be configured here. They will automatically add 32 | * validation rules to properties of a data object based upon 33 | * the type of the property. 34 | */ 35 | 'rule_inferrers' => [ 36 | Spatie\LaravelData\RuleInferrers\SometimesRuleInferrer::class, 37 | Spatie\LaravelData\RuleInferrers\NullableRuleInferrer::class, 38 | Spatie\LaravelData\RuleInferrers\RequiredRuleInferrer::class, 39 | Spatie\LaravelData\RuleInferrers\BuiltInTypesRuleInferrer::class, 40 | Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class, 41 | ], 42 | 43 | /** 44 | * Normalizers return an array representation of the payload, or null if 45 | * it cannot normalize the payload. The normalizers below are used for 46 | * every data object, unless overridden in a specific data object class. 47 | */ 48 | 'normalizers' => [ 49 | Spatie\LaravelData\Normalizers\ModelNormalizer::class, 50 | // Spatie\LaravelData\Normalizers\FormRequestNormalizer::class, 51 | Spatie\LaravelData\Normalizers\ArrayableNormalizer::class, 52 | Spatie\LaravelData\Normalizers\ObjectNormalizer::class, 53 | Spatie\LaravelData\Normalizers\ArrayNormalizer::class, 54 | Spatie\LaravelData\Normalizers\JsonNormalizer::class, 55 | ], 56 | 57 | /* 58 | * Data objects can be wrapped into a key like 'data' when used as a resource, 59 | * this key can be set globally here for all data objects. You can pass in 60 | * `null` if you want to disable wrapping. 61 | */ 62 | 'wrap' => null, 63 | 64 | /** 65 | * Adds a specific caster to the Symphony VarDumper component which hides 66 | * some properties from data objects and collections when being dumped 67 | * by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development' 68 | * which will only enable the caster locally. 69 | */ 70 | 'var_dumper_caster_mode' => 'development', 71 | ]; 72 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'search_path' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL') . '/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /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' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Deprecations Log Channel 25 | |-------------------------------------------------------------------------- 26 | | 27 | | This option controls the log channel that should be used to log warnings 28 | | regarding deprecated PHP and library features. This allows you to get 29 | | your application ready for upcoming major versions of dependencies. 30 | | 31 | */ 32 | 33 | 'deprecations' => [ 34 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 35 | 'trace' => false, 36 | ], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Log Channels 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Here you may configure the log channels for your application. Out of 44 | | the box, Laravel uses the Monolog PHP logging library. This gives 45 | | you a variety of powerful log handlers / formatters to utilize. 46 | | 47 | | Available Drivers: "single", "daily", "slack", "syslog", 48 | | "errorlog", "monolog", 49 | | "custom", "stack" 50 | | 51 | */ 52 | 53 | 'channels' => [ 54 | 'stack' => [ 55 | 'driver' => 'stack', 56 | 'channels' => ['single'], 57 | 'ignore_exceptions' => false, 58 | ], 59 | 60 | 'single' => [ 61 | 'driver' => 'single', 62 | 'path' => storage_path('logs/laravel.log'), 63 | 'level' => env('LOG_LEVEL', 'debug'), 64 | ], 65 | 66 | 'daily' => [ 67 | 'driver' => 'daily', 68 | 'path' => storage_path('logs/laravel.log'), 69 | 'level' => env('LOG_LEVEL', 'debug'), 70 | 'days' => 14, 71 | ], 72 | 73 | 'slack' => [ 74 | 'driver' => 'slack', 75 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 76 | 'username' => 'Laravel Log', 77 | 'emoji' => ':boom:', 78 | 'level' => env('LOG_LEVEL', 'critical'), 79 | ], 80 | 81 | 'papertrail' => [ 82 | 'driver' => 'monolog', 83 | 'level' => env('LOG_LEVEL', 'debug'), 84 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 85 | 'handler_with' => [ 86 | 'host' => env('PAPERTRAIL_URL'), 87 | 'port' => env('PAPERTRAIL_PORT'), 88 | 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), 89 | ], 90 | ], 91 | 92 | 'stderr' => [ 93 | 'driver' => 'monolog', 94 | 'level' => env('LOG_LEVEL', 'debug'), 95 | 'handler' => StreamHandler::class, 96 | 'formatter' => env('LOG_STDERR_FORMATTER'), 97 | 'with' => [ 98 | 'stream' => 'php://stderr', 99 | ], 100 | ], 101 | 102 | 'syslog' => [ 103 | 'driver' => 'syslog', 104 | 'level' => env('LOG_LEVEL', 'debug'), 105 | 'facility' => LOG_USER, 106 | ], 107 | 108 | 'errorlog' => [ 109 | 'driver' => 'errorlog', 110 | 'level' => env('LOG_LEVEL', 'debug'), 111 | ], 112 | 113 | 'null' => [ 114 | 'driver' => 'monolog', 115 | 'handler' => NullHandler::class, 116 | ], 117 | 118 | 'emergency' => [ 119 | 'path' => storage_path('logs/laravel.log'), 120 | ], 121 | ], 122 | 123 | ]; 124 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | // 'client' => [ 55 | // 'timeout' => 5, 56 | // ], 57 | ], 58 | 59 | 'postmark' => [ 60 | 'transport' => 'postmark', 61 | // 'client' => [ 62 | // 'timeout' => 5, 63 | // ], 64 | ], 65 | 66 | 'sendmail' => [ 67 | 'transport' => 'sendmail', 68 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 69 | ], 70 | 71 | 'log' => [ 72 | 'transport' => 'log', 73 | 'channel' => env('MAIL_LOG_CHANNEL'), 74 | ], 75 | 76 | 'array' => [ 77 | 'transport' => 'array', 78 | ], 79 | 80 | 'failover' => [ 81 | 'transport' => 'failover', 82 | 'mailers' => [ 83 | 'smtp', 84 | 'log', 85 | ], 86 | ], 87 | ], 88 | 89 | /* 90 | |-------------------------------------------------------------------------- 91 | | Global "From" Address 92 | |-------------------------------------------------------------------------- 93 | | 94 | | You may wish for all e-mails sent by your application to be sent from 95 | | the same address. Here, you may specify a name and address that is 96 | | used globally for all e-mails that are sent by your application. 97 | | 98 | */ 99 | 100 | 'from' => [ 101 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 102 | 'name' => env('MAIL_FROM_NAME', 'Example'), 103 | ], 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Markdown Mail Settings 108 | |-------------------------------------------------------------------------- 109 | | 110 | | If you are using Markdown based email rendering, you may configure your 111 | | theme and component paths here, allowing you to customize the design 112 | | of the emails. Or, you may simply stick with the Laravel defaults! 113 | | 114 | */ 115 | 116 | 'markdown' => [ 117 | 'theme' => 'default', 118 | 119 | 'paths' => [ 120 | resource_path('views/vendor/mail'), 121 | ], 122 | ], 123 | 124 | ]; 125 | -------------------------------------------------------------------------------- /config/query-builder.php: -------------------------------------------------------------------------------- 1 | [ 12 | 'include' => 'include', 13 | 14 | 'filter' => 'filter', 15 | 16 | 'sort' => 'sort', 17 | 18 | 'fields' => 'fields', 19 | 20 | 'append' => 'append', 21 | ], 22 | 23 | /* 24 | * Related model counts are included using the relationship name suffixed with this string. 25 | * For example: GET /users?include=postsCount 26 | */ 27 | 'count_suffix' => 'Count', 28 | 29 | /* 30 | * By default the package will throw an `InvalidFilterQuery` exception when a filter in the 31 | * URL is not allowed in the `allowedFilters()` method. 32 | */ 33 | 'disable_invalid_filter_query_exception' => false, 34 | 35 | /* 36 | * By default the package will throw an `InvalidSortQuery` exception when a sort in the 37 | * URL is not allowed in the `allowedSorts()` method. 38 | */ 39 | 'disable_invalid_sort_query_exception' => false, 40 | 41 | /* 42 | * By default the package inspects query string of request using $request->query(). 43 | * You can change this behavior to inspect the request body using $request->input() 44 | * by setting this value to `body`. 45 | * 46 | * Possible values: `query_string`, `body` 47 | */ 48 | 'request_data_source' => 'query_string', 49 | ]; 50 | -------------------------------------------------------------------------------- /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 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/scribe.php: -------------------------------------------------------------------------------- 1 | 'default', 8 | 9 | /* 10 | * The HTML for the generated documentation. If this is empty, Scribe will infer it from config('app.name'). 11 | */ 12 | 'title' => null, 13 | 14 | /* 15 | * A short description of your API. Will be included in the docs webpage, Postman collection and OpenAPI spec. 16 | */ 17 | 'description' => '', 18 | 19 | /* 20 | * The base URL displayed in the docs. If this is empty, Scribe will use the value of config('app.url'). 21 | */ 22 | 'base_url' => null, 23 | 24 | /* 25 | * Tell Scribe what routes to generate documentation for. 26 | * Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections) 27 | * and settings which should be applied to them ('apply' section). 28 | */ 29 | 'routes' => [ 30 | [ 31 | /* 32 | * Specify conditions to determine what routes will be a part of this group. 33 | * A route must fulfill ALL conditions to be included. 34 | */ 35 | 'match' => [ 36 | /* 37 | * Match only routes whose paths match this pattern (use * as a wildcard to match any characters). Example: 'users/*'. 38 | */ 39 | 'prefixes' => ['api/*'], 40 | 41 | /* 42 | * Match only routes whose domains match this pattern (use * as a wildcard to match any characters). Example: 'api.*'. 43 | */ 44 | 'domains' => ['*'], 45 | 46 | /* 47 | * [Dingo router only] Match only routes registered under this version. Wildcards are not supported. 48 | */ 49 | 'versions' => ['v1'], 50 | ], 51 | 52 | /* 53 | * Include these routes even if they did not match the rules above. 54 | * The route can be referenced by name or path here. Wildcards are supported. 55 | */ 56 | 'include' => [ 57 | // 'users.index', 'healthcheck*' 58 | ], 59 | 60 | /* 61 | * Exclude these routes even if they matched the rules above. 62 | * The route can be referenced by name or path here. Wildcards are supported. 63 | */ 64 | 'exclude' => [ 65 | // '/health', 'admin.*' 66 | ], 67 | 68 | /* 69 | * Settings to be applied to all the matched routes in this group when generating documentation 70 | */ 71 | 'apply' => [ 72 | /* 73 | * Additional headers to be added to the example requests 74 | */ 75 | 'headers' => [ 76 | 'Content-Type' => 'application/json', 77 | 'Accept' => 'application/json', 78 | ], 79 | 80 | /* 81 | * If no @response or @transformer declarations are found for the route, 82 | * Scribe will try to get a sample response by attempting an API call. 83 | * Configure the settings for the API call here. 84 | */ 85 | 'response_calls' => [ 86 | /* 87 | * API calls will be made only for routes in this group matching these HTTP methods (GET, POST, etc). 88 | * List the methods here or use '*' to mean all methods. Leave empty to disable API calls. 89 | */ 90 | 'methods' => ['GET'], 91 | 92 | /* 93 | * Laravel config variables which should be set for the API call. 94 | * This is a good place to ensure that notifications, emails and other external services 95 | * are not triggered during the documentation API calls. 96 | * You can also create a `.env.docs` file and run the generate command with `--env docs`. 97 | */ 98 | 'config' => [ 99 | 'app.env' => 'documentation', 100 | // 'app.debug' => false, 101 | ], 102 | 103 | /* 104 | * Query parameters which should be sent with the API call. 105 | */ 106 | 'queryParams' => [ 107 | // 'key' => 'value', 108 | ], 109 | 110 | /* 111 | * Body parameters which should be sent with the API call. 112 | */ 113 | 'bodyParams' => [ 114 | // 'key' => 'value', 115 | ], 116 | 117 | /* 118 | * Files which should be sent with the API call. 119 | * Each value should be a valid path (absolute or relative to your project directory) to a file on this machine (but not in the project root). 120 | */ 121 | 'fileParams' => [ 122 | // 'key' => 'storage/app/image.png', 123 | ], 124 | 125 | /* 126 | * Cookies which should be sent with the API call. 127 | */ 128 | 'cookies' => [ 129 | // 'name' => 'value' 130 | ], 131 | ], 132 | ], 133 | ], 134 | ], 135 | 136 | /* 137 | * The type of documentation output to generate. 138 | * - "static" will generate a static HTMl page in the /public/docs folder, 139 | * - "laravel" will generate the documentation as a Blade view, so you can add routing and authentication. 140 | */ 141 | 'type' => 'static', 142 | 143 | /* 144 | * Settings for `static` type output. 145 | */ 146 | 'static' => [ 147 | /* 148 | * HTML documentation, assets and Postman collection will be generated to this folder. 149 | * Source Markdown will still be in resources/docs. 150 | */ 151 | 'output_path' => 'public/docs', 152 | ], 153 | 154 | /* 155 | * Settings for `laravel` type output. 156 | */ 157 | 'laravel' => [ 158 | /* 159 | * Whether to automatically create a docs endpoint for you to view your generated docs. 160 | * If this is false, you can still set up routing manually. 161 | */ 162 | 'add_routes' => true, 163 | 164 | /* 165 | * URL path to use for the docs endpoint (if `add_routes` is true). 166 | * By default, `/docs` opens the HTML page, `/docs.postman` opens the Postman collection, and `/docs.openapi` the OpenAPI spec. 167 | */ 168 | 'docs_url' => '/docs', 169 | 170 | /* 171 | * Directory within `public` in which to store CSS and JS assets. 172 | * By default, assets are stored in `public/vendor/scribe`. 173 | * If set, assets will be stored in `public/{{assets_directory}}` 174 | */ 175 | 'assets_directory' => null, 176 | 177 | /* 178 | * Middleware to attach to the docs endpoint (if `add_routes` is true). 179 | */ 180 | 'middleware' => [], 181 | ], 182 | 183 | 'try_it_out' => [ 184 | /** 185 | * Add a Try It Out button to your endpoints so consumers can test endpoints right from their browser. 186 | * Don't forget to enable CORS headers for your endpoints. 187 | */ 188 | 'enabled' => true, 189 | 190 | /** 191 | * The base URL for the API tester to use (for example, you can set this to your staging URL). 192 | * Leave as null to use the current app URL (config(app.url)). 193 | */ 194 | 'base_url' => null, 195 | 196 | /** 197 | * Fetch a CSRF token before each request, and add it as an X-XSRF-TOKEN header. Needed if you're using Laravel Sanctum. 198 | */ 199 | 'use_csrf' => false, 200 | 201 | /** 202 | * The URL to fetch the CSRF token from (if `use_csrf` is true). 203 | */ 204 | 'csrf_url' => '/sanctum/csrf-cookie', 205 | ], 206 | 207 | /* 208 | * How is your API authenticated? This information will be used in the displayed docs, generated examples and response calls. 209 | */ 210 | 'auth' => [ 211 | /* 212 | * Set this to true if any endpoints in your API use authentication. 213 | */ 214 | 'enabled' => true, 215 | 216 | /* 217 | * Set this to true if your API should be authenticated by default. If so, you must also set `enabled` (above) to true. 218 | * You can then use @unauthenticated or @authenticated on individual endpoints to change their status from the default. 219 | */ 220 | 'default' => true, 221 | 222 | /* 223 | * Where is the auth value meant to be sent in a request? 224 | * Options: query, body, basic, bearer, header (for custom header) 225 | */ 226 | 'in' => 'bearer', 227 | 228 | /* 229 | * The name of the auth parameter (eg token, key, apiKey) or header (eg Authorization, Api-Key). 230 | */ 231 | 'name' => 'Authorization', 232 | 233 | /* 234 | * The value of the parameter to be used by Scribe to authenticate response calls. 235 | * This will NOT be included in the generated documentation. 236 | * If this value is empty, Scribe will use a random value. 237 | */ 238 | 'use_value' => env('SCRIBE_AUTH_KEY'), 239 | 240 | /* 241 | * Placeholder your users will see for the auth parameter in the example requests. 242 | * Set this to null if you want Scribe to use a random value as placeholder instead. 243 | */ 244 | 'placeholder' => '{YOUR_AUTH_KEY}', 245 | 246 | /* 247 | * Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials. 248 | * Markdown and HTML are supported. 249 | */ 250 | 'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.', 251 | ], 252 | 253 | /* 254 | * Text to place in the "Introduction" section, right after the `description`. Markdown and HTML are supported. 255 | */ 256 | 'intro_text' => <<<INTRO 257 | This documentation aims to provide all the information you need to work with our API. 258 | 259 | - The API is currently in <b>beta</b>. If you find any bugs, please report them on the team channel. 260 | - If you have any questions, please feel free to contact us on the team channel. 261 | - We are actively working on improving the API and adding new features. 262 | - The documentation is generated from the source code. 263 | - The API is available at <a>{your staging URL}</a>. 264 | - You can call endpoints using mock server that will provide you with <b>success</b> response : <a>{Your Mock Server URL}</a> 265 | - 266 | - Status code <b>500</b> is used for internal server errors. 267 | - Status code <b>405</b> is used for wrong method call. 268 | - Status code <b>401</b> is used for unauthorized requests and can occur in requests that require <b>authentication</b> only. 269 | - Status code <b>429</b> is used for too many request attempts. 270 | 271 | <aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile). 272 | You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside> 273 | INTRO 274 | , 275 | 276 | /* 277 | * Example requests for each endpoint will be shown in each of these languages. 278 | * Supported options are: bash, javascript, php, python 279 | * To add a language of your own, see https://scribe.knuckles.wtf/laravel/advanced/example-requests 280 | * 281 | */ 282 | 'example_languages' => [ 283 | 'bash', 284 | 'javascript', 285 | ], 286 | 287 | /* 288 | * Generate a Postman collection (v2.1.0) in addition to HTML docs. 289 | * For 'static' docs, the collection will be generated to public/docs/collection.json. 290 | * For 'laravel' docs, it will be generated to storage/app/scribe/collection.json. 291 | * Setting `laravel.add_routes` to true (above) will also add a route for the collection. 292 | */ 293 | 'postman' => [ 294 | 'enabled' => true, 295 | 296 | /* 297 | * Manually override some generated content in the spec. Dot notation is supported. 298 | */ 299 | 'overrides' => [ 300 | // 'info.version' => '2.0.0', 301 | ], 302 | ], 303 | 304 | /* 305 | * Generate an OpenAPI spec (v3.0.1) in addition to docs webpage. 306 | * For 'static' docs, the collection will be generated to public/docs/openapi.yaml. 307 | * For 'laravel' docs, it will be generated to storage/app/scribe/openapi.yaml. 308 | * Setting `laravel.add_routes` to true (above) will also add a route for the spec. 309 | */ 310 | 'openapi' => [ 311 | 'enabled' => true, 312 | 313 | /* 314 | * Manually override some generated content in the spec. Dot notation is supported. 315 | */ 316 | 'overrides' => [ 317 | // 'info.version' => '2.0.0', 318 | ], 319 | ], 320 | 321 | 'groups' => [ 322 | /* 323 | * Endpoints which don't have a @group will be placed in this default group. 324 | */ 325 | 'default' => 'Endpoints', 326 | 327 | /* 328 | * By default, Scribe will sort groups alphabetically, and endpoints in the order their routes are defined. 329 | * You can override this by listing the groups, subgroups and endpoints here in the order you want them. 330 | * 331 | * Any groups, subgroups or endpoints you don't list here will be added as usual after the ones here. 332 | * If an endpoint/subgroup is listed under a group it doesn't belong in, it will be ignored. 333 | * Note: you must include the initial '/' when writing an endpoint. 334 | */ 335 | 'order' => [ 336 | // 'This group will come first', 337 | // 'This group will come next' => [ 338 | // 'POST /this-endpoint-will-comes-first', 339 | // 'GET /this-endpoint-will-comes-next', 340 | // ], 341 | // 'This group will come third' => [ 342 | // 'This subgroup will come first' => [ 343 | // 'GET /this-other-endpoint-will-comes-first', 344 | // 'GET /this-other-endpoint-will-comes-next', 345 | // ] 346 | // ] 347 | ], 348 | ], 349 | 350 | /* 351 | * Custom logo path. This will be used as the value of the src attribute for the <img> tag, 352 | * so make sure it points to an accessible URL or path. Set to false to not use a logo. 353 | * 354 | * For example, if your logo is in public/img: 355 | * - 'logo' => '../img/logo.png' // for `static` type (output folder is public/docs) 356 | * - 'logo' => 'img/logo.png' // for `laravel` type 357 | * 358 | */ 359 | 'logo' => false, 360 | 361 | /** 362 | * Customize the "Last updated" value displayed in the docs by specifying tokens and formats. 363 | * Examples: 364 | * - {date:F j Y} => March 28, 2022 365 | * - {git:short} => Short hash of the last Git commit 366 | * 367 | * Available tokens are `{date:<format>}` and `{git:<format>}`. 368 | * The format you pass to `date` will be passed to PhP's `date()` function. 369 | * The format you pass to `git` can be either "short" or "long". 370 | */ 371 | 'last_updated' => 'Last updated: {date:F j, Y}', 372 | 373 | 'examples' => [ 374 | /* 375 | * If you would like the package to generate the same example values for parameters on each run, 376 | * set this to any number (eg. 1234) 377 | */ 378 | 'faker_seed' => null, 379 | 380 | /* 381 | * With API resources and transformers, Scribe tries to generate example models to use in your API responses. 382 | * By default, Scribe will try the model's factory, and if that fails, try fetching the first from the database. 383 | * You can reorder or remove strategies here. 384 | */ 385 | 'models_source' => ['factoryCreate', 'factoryMake', 'databaseFirst'], 386 | ], 387 | 388 | /** 389 | * The strategies Scribe will use to extract information about your routes at each stage. 390 | * If you create or install a custom strategy, add it here. 391 | */ 392 | 'strategies' => [ 393 | 'metadata' => [ 394 | Strategies\Metadata\GetFromDocBlocks::class, 395 | Strategies\Metadata\GetFromMetadataAttributes::class, 396 | ], 397 | 'urlParameters' => [ 398 | Strategies\UrlParameters\GetFromLaravelAPI::class, 399 | Strategies\UrlParameters\GetFromLumenAPI::class, 400 | Strategies\UrlParameters\GetFromUrlParamAttribute::class, 401 | Strategies\UrlParameters\GetFromUrlParamTag::class, 402 | ], 403 | 'queryParameters' => [ 404 | Strategies\QueryParameters\GetFromFormRequest::class, 405 | Strategies\QueryParameters\GetFromInlineValidator::class, 406 | Strategies\QueryParameters\GetFromQueryParamAttribute::class, 407 | Strategies\QueryParameters\GetFromQueryParamTag::class, 408 | \App\Helpers\DocStrategies\HasPaginationParameters::class 409 | ], 410 | 'headers' => [ 411 | Strategies\Headers\GetFromRouteRules::class, 412 | Strategies\Headers\GetFromHeaderAttribute::class, 413 | Strategies\Headers\GetFromHeaderTag::class, 414 | ], 415 | 'bodyParameters' => [ 416 | Strategies\BodyParameters\GetFromFormRequest::class, 417 | Strategies\BodyParameters\GetFromInlineValidator::class, 418 | Strategies\BodyParameters\GetFromBodyParamAttribute::class, 419 | Strategies\BodyParameters\GetFromBodyParamTag::class, 420 | ], 421 | 'responses' => [ 422 | Strategies\Responses\UseResponseAttributes::class, 423 | Strategies\Responses\UseTransformerTags::class, 424 | Strategies\Responses\UseApiResourceTags::class, 425 | Strategies\Responses\UseResponseTag::class, 426 | Strategies\Responses\UseResponseFileTag::class, 427 | Strategies\Responses\ResponseCalls::class, 428 | \App\Helpers\DocStrategies\ApiResponseTags::class, 429 | ], 430 | 'responseFields' => [ 431 | Strategies\ResponseFields\GetFromResponseFieldAttribute::class, 432 | Strategies\ResponseFields\GetFromResponseFieldTag::class, 433 | ], 434 | ], 435 | 436 | 'fractal' => [ 437 | /* If you are using a custom serializer with league/fractal, you can specify it here. 438 | * Leave as null to use no serializer or return simple JSON. 439 | */ 440 | 'serializer' => null, 441 | ], 442 | 443 | /* 444 | * [Advanced] Custom implementation of RouteMatcherInterface to customise how routes are matched 445 | * 446 | */ 447 | 'routeMatcher' => \Knuckles\Scribe\Matching\RouteMatcher::class, 448 | 449 | /** 450 | * For response calls, API resource responses and transformer responses, 451 | * Scribe will try to start database transactions, so no changes are persisted to your database. 452 | * Tell Scribe which connections should be transacted here. 453 | * If you only use one db connection, you can leave this as is. 454 | */ 455 | 'database_connections_to_transact' => [config('database.default')] 456 | ]; 457 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | return [ 4 | 5 | /* 6 | |-------------------------------------------------------------------------- 7 | | Third Party Services 8 | |-------------------------------------------------------------------------- 9 | | 10 | | This file is for storing the credentials for third party services such 11 | | as Mailgun, Postmark, AWS and more. This file provides the de facto 12 | | location for this type of information, allowing packages to have 13 | | a conventional file to locate the various service credentials. 14 | | 15 | */ 16 | 17 | 'mailgun' => [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use Illuminate\Support\Str; 4 | 5 | return [ 6 | 7 | /* 8 | |-------------------------------------------------------------------------- 9 | | Default Session Driver 10 | |-------------------------------------------------------------------------- 11 | | 12 | | This option controls the default session "driver" that will be used on 13 | | requests. By default, we will use the lightweight native driver but 14 | | you may specify any of the other wonderful drivers provided here. 15 | | 16 | | Supported: "file", "cookie", "database", "apc", 17 | | "memcached", "redis", "dynamodb", "array" 18 | | 19 | */ 20 | 21 | 'driver' => env('SESSION_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Session Lifetime 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may specify the number of minutes that you wish the session 29 | | to be allowed to remain idle before it expires. If you want them 30 | | to immediately expire on the browser closing, set that option. 31 | | 32 | */ 33 | 34 | 'lifetime' => env('SESSION_LIFETIME', 120), 35 | 36 | 'expire_on_close' => false, 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Session Encryption 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This option allows you to easily specify that all of your session data 44 | | should be encrypted before it is stored. All encryption will be run 45 | | automatically by Laravel and you can use the Session like normal. 46 | | 47 | */ 48 | 49 | 'encrypt' => false, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Session File Location 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When using the native session driver, we need a location where session 57 | | files may be stored. A default has been set for you but a different 58 | | location may be specified. This is only needed for file sessions. 59 | | 60 | */ 61 | 62 | 'files' => storage_path('framework/sessions'), 63 | 64 | /* 65 | |-------------------------------------------------------------------------- 66 | | Session Database Connection 67 | |-------------------------------------------------------------------------- 68 | | 69 | | When using the "database" or "redis" session drivers, you may specify a 70 | | connection that should be used to manage these sessions. This should 71 | | correspond to a connection in your database configuration options. 72 | | 73 | */ 74 | 75 | 'connection' => env('SESSION_CONNECTION'), 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Session Database Table 80 | |-------------------------------------------------------------------------- 81 | | 82 | | When using the "database" session driver, you may specify the table we 83 | | should use to manage the sessions. Of course, a sensible default is 84 | | provided for you; however, you are free to change this as needed. 85 | | 86 | */ 87 | 88 | 'table' => 'sessions', 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Session Cache Store 93 | |-------------------------------------------------------------------------- 94 | | 95 | | While using one of the framework's cache driven session backends you may 96 | | list a cache store that should be used for these sessions. This value 97 | | must match with one of the application's configured cache "stores". 98 | | 99 | | Affects: "apc", "dynamodb", "memcached", "redis" 100 | | 101 | */ 102 | 103 | 'store' => env('SESSION_STORE'), 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Session Sweeping Lottery 108 | |-------------------------------------------------------------------------- 109 | | 110 | | Some session drivers must manually sweep their storage location to get 111 | | rid of old sessions from storage. Here are the chances that it will 112 | | happen on a given request. By default, the odds are 2 out of 100. 113 | | 114 | */ 115 | 116 | 'lottery' => [2, 100], 117 | 118 | /* 119 | |-------------------------------------------------------------------------- 120 | | Session Cookie Name 121 | |-------------------------------------------------------------------------- 122 | | 123 | | Here you may change the name of the cookie used to identify a session 124 | | instance by ID. The name specified here will get used every time a 125 | | new session cookie is created by the framework for every driver. 126 | | 127 | */ 128 | 129 | 'cookie' => env( 130 | 'SESSION_COOKIE', 131 | Str::slug(env('APP_NAME', 'laravel'), '_') . '_session' 132 | ), 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Session Cookie Path 137 | |-------------------------------------------------------------------------- 138 | | 139 | | The session cookie path determines the path for which the cookie will 140 | | be regarded as available. Typically, this will be the root path of 141 | | your application but you are free to change this when necessary. 142 | | 143 | */ 144 | 145 | 'path' => '/', 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Session Cookie Domain 150 | |-------------------------------------------------------------------------- 151 | | 152 | | Here you may change the domain of the cookie used to identify a session 153 | | in your application. This will determine which domains the cookie is 154 | | available to in your application. A sensible default has been set. 155 | | 156 | */ 157 | 158 | 'domain' => env('SESSION_DOMAIN'), 159 | 160 | /* 161 | |-------------------------------------------------------------------------- 162 | | HTTPS Only Cookies 163 | |-------------------------------------------------------------------------- 164 | | 165 | | By setting this option to true, session cookies will only be sent back 166 | | to the server if the browser has a HTTPS connection. This will keep 167 | | the cookie from being sent to you when it can't be done securely. 168 | | 169 | */ 170 | 171 | 'secure' => env('SESSION_SECURE_COOKIE'), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | HTTP Access Only 176 | |-------------------------------------------------------------------------- 177 | | 178 | | Setting this value to true will prevent JavaScript from accessing the 179 | | value of the cookie and the cookie will only be accessible through 180 | | the HTTP protocol. You are free to modify this option if needed. 181 | | 182 | */ 183 | 184 | 'http_only' => true, 185 | 186 | /* 187 | |-------------------------------------------------------------------------- 188 | | Same-Site Cookies 189 | |-------------------------------------------------------------------------- 190 | | 191 | | This option determines how your cookies behave when cross-site requests 192 | | take place, and can be used to mitigate CSRF attacks. By default, we 193 | | will set this value to "lax" since this is a secure default value. 194 | | 195 | | Supported: "lax", "strict", "none", null 196 | | 197 | */ 198 | 199 | 'same_site' => 'lax', 200 | 201 | ]; 202 | -------------------------------------------------------------------------------- /config/telescope.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use Laravel\Telescope\Http\Middleware\Authorize; 4 | use Laravel\Telescope\Watchers; 5 | 6 | return [ 7 | 8 | /* 9 | |-------------------------------------------------------------------------- 10 | | Telescope Domain 11 | |-------------------------------------------------------------------------- 12 | | 13 | | This is the subdomain where Telescope will be accessible from. If the 14 | | setting is null, Telescope will reside under the same domain as the 15 | | application. Otherwise, this value will be used as the subdomain. 16 | | 17 | */ 18 | 19 | 'domain' => env('TELESCOPE_DOMAIN', null), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Telescope Path 24 | |-------------------------------------------------------------------------- 25 | | 26 | | This is the URI path where Telescope will be accessible from. Feel free 27 | | to change this path to anything you like. Note that the URI will not 28 | | affect the paths of its internal API that aren't exposed to users. 29 | | 30 | */ 31 | 32 | 'path' => env('TELESCOPE_PATH', 'telescope'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Telescope Storage Driver 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This configuration options determines the storage driver that will 40 | | be used to store Telescope's data. In addition, you may set any 41 | | custom options as needed by the particular driver you choose. 42 | | 43 | */ 44 | 45 | 'driver' => env('TELESCOPE_DRIVER', 'database'), 46 | 47 | 'storage' => [ 48 | 'database' => [ 49 | 'connection' => env('DB_CONNECTION', 'mysql'), 50 | 'chunk' => 1000, 51 | ], 52 | ], 53 | 54 | /* 55 | |-------------------------------------------------------------------------- 56 | | Telescope Master Switch 57 | |-------------------------------------------------------------------------- 58 | | 59 | | This option may be used to disable all Telescope watchers regardless 60 | | of their individual configuration, which simply provides a single 61 | | and convenient way to enable or disable Telescope data storage. 62 | | 63 | */ 64 | 65 | 'enabled' => env('TELESCOPE_ENABLED', true), 66 | 67 | /* 68 | |-------------------------------------------------------------------------- 69 | | Telescope Route Middleware 70 | |-------------------------------------------------------------------------- 71 | | 72 | | These middleware will be assigned to every Telescope route, giving you 73 | | the chance to add your own middleware to this list or change any of 74 | | the existing middleware. Or, you can simply stick with this list. 75 | | 76 | */ 77 | 78 | 'middleware' => [ 79 | 'web', 80 | Authorize::class, 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Allowed / Ignored Paths & Commands 86 | |-------------------------------------------------------------------------- 87 | | 88 | | The following array lists the URI paths and Artisan commands that will 89 | | not be watched by Telescope. In addition to this list, some Laravel 90 | | commands, like migrations and queue commands, are always ignored. 91 | | 92 | */ 93 | 94 | 'only_paths' => [ 95 | // 'api/*' 96 | ], 97 | 98 | 'ignore_paths' => [ 99 | 'nova-api*', 100 | ], 101 | 102 | 'ignore_commands' => [ 103 | 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Telescope Watchers 109 | |-------------------------------------------------------------------------- 110 | | 111 | | The following array lists the "watchers" that will be registered with 112 | | Telescope. The watchers gather the application's profile data when 113 | | a request or task is executed. Feel free to customize this list. 114 | | 115 | */ 116 | 117 | 'watchers' => [ 118 | Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), 119 | 120 | Watchers\CacheWatcher::class => [ 121 | 'enabled' => env('TELESCOPE_CACHE_WATCHER', true), 122 | 'hidden' => [], 123 | ], 124 | 125 | Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), 126 | 127 | Watchers\CommandWatcher::class => [ 128 | 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), 129 | 'ignore' => [], 130 | ], 131 | 132 | Watchers\DumpWatcher::class => [ 133 | 'enabled' => env('TELESCOPE_DUMP_WATCHER', true), 134 | 'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false), 135 | ], 136 | 137 | Watchers\EventWatcher::class => [ 138 | 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), 139 | 'ignore' => [], 140 | ], 141 | 142 | Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), 143 | 144 | Watchers\GateWatcher::class => [ 145 | 'enabled' => env('TELESCOPE_GATE_WATCHER', true), 146 | 'ignore_abilities' => [], 147 | 'ignore_packages' => true, 148 | 'ignore_paths' => [], 149 | ], 150 | 151 | Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), 152 | 153 | Watchers\LogWatcher::class => [ 154 | 'enabled' => env('TELESCOPE_LOG_WATCHER', true), 155 | 'level' => 'error', 156 | ], 157 | 158 | Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), 159 | 160 | Watchers\ModelWatcher::class => [ 161 | 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), 162 | 'events' => ['eloquent.*'], 163 | 'hydrations' => true, 164 | ], 165 | 166 | Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), 167 | 168 | Watchers\QueryWatcher::class => [ 169 | 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), 170 | 'ignore_packages' => true, 171 | 'ignore_paths' => [], 172 | 'slow' => 100, 173 | ], 174 | 175 | Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), 176 | 177 | Watchers\RequestWatcher::class => [ 178 | 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), 179 | 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), 180 | 'ignore_http_methods' => [], 181 | 'ignore_status_codes' => [], 182 | ], 183 | 184 | Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), 185 | Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), 186 | ], 187 | ]; 188 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | return [ 4 | 5 | /* 6 | |-------------------------------------------------------------------------- 7 | | View Storage Paths 8 | |-------------------------------------------------------------------------- 9 | | 10 | | Most templating systems load templates from disk. Here you may specify 11 | | an array of paths that should be checked for your views. Of course 12 | | the usual Laravel view path has already been registered for you. 13 | | 14 | */ 15 | 16 | 'paths' => [ 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 | -------------------------------------------------------------------------------- /database/factories/Client/UserFactory.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Database\Factories\Client; 4 | 5 | use Domain\Client\Models\User; 6 | use Illuminate\Database\Eloquent\Factories\Factory; 7 | use Illuminate\Support\Str; 8 | 9 | /** 10 | * @extends \Illuminate\Database\Eloquent\Factories\Factory<\Domain\Client\Models\User> 11 | */ 12 | class UserFactory extends Factory 13 | { 14 | protected $model = User::class; 15 | 16 | /** 17 | * Define the model's default state. 18 | * 19 | * @return array<string, mixed> 20 | */ 21 | public function definition(): array 22 | { 23 | return [ 24 | 'name' => fake()->name(), 25 | 'email' => fake()->unique()->safeEmail(), 26 | 'email_verified_at' => now(), 27 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 28 | 'remember_token' => Str::random(10), 29 | ]; 30 | } 31 | 32 | /** 33 | * Indicate that the model's email address should be unverified. 34 | */ 35 | public function unverified(): static 36 | { 37 | return $this->state(fn (array $attributes) => [ 38 | 'email_verified_at' => null, 39 | ]); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use Illuminate\Database\Migrations\Migration; 4 | use Illuminate\Database\Schema\Blueprint; 5 | use Illuminate\Support\Facades\Schema; 6 | 7 | return new class () extends Migration { 8 | /** 9 | * Run the migrations. 10 | */ 11 | public function up(): void 12 | { 13 | Schema::create('failed_jobs', function (Blueprint $table): void { 14 | $table->id(); 15 | $table->string('uuid')->unique(); 16 | $table->text('connection'); 17 | $table->text('queue'); 18 | $table->longText('payload'); 19 | $table->longText('exception'); 20 | $table->timestamp('failed_at')->useCurrent(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('failed_jobs'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/Client/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use Illuminate\Database\Migrations\Migration; 4 | use Illuminate\Database\Schema\Blueprint; 5 | use Illuminate\Support\Facades\Schema; 6 | 7 | return new class () extends Migration { 8 | /** 9 | * Run the migrations. 10 | */ 11 | public function up(): void 12 | { 13 | Schema::create('users', function (Blueprint $table): void { 14 | $table->id(); 15 | $table->string('name'); 16 | $table->string('email')->unique(); 17 | $table->timestamp('email_verified_at')->nullable(); 18 | $table->string('password'); 19 | $table->rememberToken(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('users'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/Client/2014_10_12_100000_create_password_reset_tokens_table.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use Illuminate\Database\Migrations\Migration; 4 | use Illuminate\Database\Schema\Blueprint; 5 | use Illuminate\Support\Facades\Schema; 6 | 7 | return new class () extends Migration { 8 | /** 9 | * Run the migrations. 10 | */ 11 | public function up(): void 12 | { 13 | Schema::create('password_reset_tokens', function (Blueprint $table): void { 14 | $table->string('email')->primary(); 15 | $table->string('token'); 16 | $table->timestamp('created_at')->nullable(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::dropIfExists('password_reset_tokens'); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /database/seeders/Client/UserSeeder.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Database\Seeders\Client; 4 | 5 | use Domain\Client\Models\User; 6 | use Illuminate\Database\Seeder; 7 | use Illuminate\Support\Facades\Hash; 8 | use Illuminate\Support\Str; 9 | 10 | class UserSeeder extends Seeder 11 | { 12 | /** 13 | * Run the database seeds. 14 | * 15 | * @return void 16 | */ 17 | public function run(): void 18 | { 19 | User::query()->firstOrCreate([ 20 | 'email' => 'admin@project.com', 21 | ], [ 22 | 'name' => 'Admin', 23 | 'email_verified_at' => now(), 24 | 'password' => Hash::make('password'), 25 | 'remember_token' => Str::random(10), 26 | ]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Database\Seeders; 4 | 5 | // use Illuminate\Database\Console\Seeds\WithoutModelEvents; 6 | use Database\Seeders\Client\UserSeeder; 7 | use Illuminate\Database\Seeder; 8 | 9 | class DatabaseSeeder extends Seeder 10 | { 11 | /* 12 | |-------------------------------------------------------------------------- 13 | | Seeding Strategy 14 | |-------------------------------------------------------------------------- 15 | | 16 | | In order to maintain your seeders working even after production, try to check for seeded data 17 | | existence in the database before seeding it. This can help you in development to avoid 18 | | a database refreshing when seeding new data and will also prevent duplicated data. 19 | | 20 | */ 21 | 22 | public function run(): void 23 | { 24 | // production seeders. 25 | $this->call([ 26 | UserSeeder::class, 27 | ]); 28 | 29 | 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Disable ForeignKey Constraints 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Disabling foreign key constraints give flexibility to your testing seeders, but 37 | | it may result data inconsistency. so be careful if you decide to disable them. 38 | | 39 | */ 40 | if (app()->environment(['local', 'staging', 'testing'])) { 41 | // Schema::disableForeignKeyConstraints(); 42 | $this->call(TestingSeeder::class); 43 | // Schema::enableForeignKeyConstraints(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /database/seeders/TestingSeeder.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Database\Seeders; 4 | 5 | use Illuminate\Database\Seeder; 6 | 7 | class TestingSeeder extends Seeder 8 | { 9 | /** 10 | * Seed the application's database. 11 | * 12 | * @return void 13 | */ 14 | public function run(): void 15 | { 16 | // testing seeders. 17 | $this->call([ 18 | ]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | laravel.test: 4 | build: 5 | context: ./vendor/laravel/sail/runtimes/8.2 6 | dockerfile: Dockerfile 7 | args: 8 | WWWGROUP: '${WWWGROUP}' 9 | image: sail-8.2/app 10 | extra_hosts: 11 | - 'host.docker.internal:host-gateway' 12 | ports: 13 | - '${APP_PORT:-80}:80' 14 | - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' 15 | environment: 16 | WWWUSER: '${WWWUSER}' 17 | LARAVEL_SAIL: 1 18 | XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' 19 | XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' 20 | volumes: 21 | - '.:/var/www/html' 22 | networks: 23 | - sail 24 | depends_on: 25 | - mysql 26 | - redis 27 | - meilisearch 28 | - mailpit 29 | mysql: 30 | image: 'mysql/mysql-server:8.0' 31 | ports: 32 | - '${FORWARD_DB_PORT:-3306}:3306' 33 | environment: 34 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' 35 | MYSQL_ROOT_HOST: '%' 36 | MYSQL_DATABASE: '${DB_DATABASE}' 37 | MYSQL_USER: '${DB_USERNAME}' 38 | MYSQL_PASSWORD: '${DB_PASSWORD}' 39 | MYSQL_ALLOW_EMPTY_PASSWORD: 1 40 | volumes: 41 | - 'sail-mysql:/var/lib/mysql' 42 | - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' 43 | networks: 44 | - sail 45 | healthcheck: 46 | test: 47 | - CMD 48 | - mysqladmin 49 | - ping 50 | - '-p${DB_PASSWORD}' 51 | retries: 3 52 | timeout: 5s 53 | redis: 54 | image: 'redis:alpine' 55 | ports: 56 | - '${FORWARD_REDIS_PORT:-6379}:6379' 57 | volumes: 58 | - 'sail-redis:/data' 59 | networks: 60 | - sail 61 | healthcheck: 62 | test: 63 | - CMD 64 | - redis-cli 65 | - ping 66 | retries: 3 67 | timeout: 5s 68 | meilisearch: 69 | image: 'getmeili/meilisearch:latest' 70 | ports: 71 | - '${FORWARD_MEILISEARCH_PORT:-7700}:7700' 72 | volumes: 73 | - 'sail-meilisearch:/meili_data' 74 | networks: 75 | - sail 76 | healthcheck: 77 | test: 78 | - CMD 79 | - wget 80 | - '--no-verbose' 81 | - '--spider' 82 | - 'http://localhost:7700/health' 83 | retries: 3 84 | timeout: 5s 85 | mailpit: 86 | image: 'axllent/mailpit:latest' 87 | ports: 88 | - '${FORWARD_MAILPIT_PORT:-1025}:1025' 89 | - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' 90 | networks: 91 | - sail 92 | networks: 93 | sail: 94 | driver: bridge 95 | volumes: 96 | sail-mysql: 97 | driver: local 98 | sail-redis: 99 | driver: local 100 | sail-meilisearch: 101 | driver: local 102 | -------------------------------------------------------------------------------- /grumphp.yml: -------------------------------------------------------------------------------- 1 | grumphp: 2 | tasks: 3 | phpcs: 4 | standard: PSR12 5 | ignore_patterns: [./public/*, ./resources/*, ./tests/pest.php, ./database/migrations/*, ./config/*, ./bootstrap/*] 6 | ignore_unstaged_changes: true 7 | parallel: 8 | enabled: true 9 | max_workers: 32 10 | fixer: 11 | enabled: true 12 | fix_by_default: false -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "axios": "^1.1.2", 9 | "laravel-vite-plugin": "^0.7.2", 10 | "vite": "^4.0.0" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache"> 3 | <testsuites> 4 | <testsuite name="Unit"> 5 | <directory suffix="Test.php">./tests/Unit</directory> 6 | </testsuite> 7 | <testsuite name="Feature"> 8 | <directory suffix="Test.php">./tests/Feature</directory> 9 | </testsuite> 10 | </testsuites> 11 | <coverage> 12 | <include> 13 | <directory suffix=".php">./src</directory> 14 | </include> 15 | </coverage> 16 | <php> 17 | <env name="APP_ENV" value="testing"/> 18 | <env name="BCRYPT_ROUNDS" value="4"/> 19 | <env name="CACHE_DRIVER" value="array"/> 20 | <env name="DB_DATABASE" value="testing"/> 21 | <!-- In memory sqlite database connection--> 22 | <!-- <env name="DB_CONNECTION" value="sqlite"/>--> 23 | <!-- <env name="DB_DATABASE" value=":memory:"/>--> 24 | <env name="MAIL_MAILER" value="array"/> 25 | <env name="QUEUE_CONNECTION" value="sync"/> 26 | <env name="SESSION_DRIVER" value="array"/> 27 | <env name="TELESCOPE_ENABLED" value="false"/> 28 | </php> 29 | </phpunit> 30 | -------------------------------------------------------------------------------- /pint.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "preset": "psr12", 4 | "rules": { 5 | "align_multiline_comment": true, 6 | "array_indentation": true, 7 | "array_syntax": true, 8 | "blank_line_after_namespace": true, 9 | "blank_line_after_opening_tag": true, 10 | "combine_consecutive_issets": true, 11 | "combine_consecutive_unsets": true, 12 | "concat_space": { 13 | "spacing": "one" 14 | }, 15 | "declare_parentheses": true, 16 | "declare_strict_types": false, 17 | "explicit_string_variable": true, 18 | "final_class": false, 19 | "final_internal_class": false, 20 | "fully_qualified_strict_types": false, 21 | "global_namespace_import": { 22 | "import_classes": true, 23 | "import_constants": true, 24 | "import_functions": true 25 | }, 26 | "is_null": true, 27 | "lambda_not_used_import": true, 28 | "logical_operators": true, 29 | "mb_str_functions": true, 30 | "method_chaining_indentation": true, 31 | "modernize_strpos": true, 32 | "new_with_braces": true, 33 | "no_empty_comment": true, 34 | "not_operator_with_space": true, 35 | "ordered_traits": true, 36 | "protected_to_private": true, 37 | "simplified_if_return": true, 38 | "strict_comparison": true, 39 | "ternary_to_null_coalescing": true, 40 | "trim_array_spaces": true, 41 | "use_arrow_functions": false, 42 | "void_return": true, 43 | "yoda_style": true 44 | } 45 | } -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | <IfModule mod_rewrite.c> 2 | <IfModule mod_negotiation.c> 3 | Options -MultiViews -Indexes 4 | </IfModule> 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | </IfModule> 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abd-wazzan/laravel-api-boilerplate/e477b397996cf4ba19e062ae748bd204fe6f18ec/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | use Illuminate\Contracts\Http\Kernel; 4 | use Illuminate\Http\Request; 5 | 6 | define('LARAVEL_START', microtime(true)); 7 | 8 | /* 9 | |-------------------------------------------------------------------------- 10 | | Check If The Application Is Under Maintenance 11 | |-------------------------------------------------------------------------- 12 | | 13 | | If the application is in maintenance / demo mode via the "down" command 14 | | we will load this file so that any pre-rendered content can be shown 15 | | instead of starting the framework, which could cause an exception. 16 | | 17 | */ 18 | 19 | if (file_exists($maintenance = __DIR__ . '/../storage/framework/maintenance.php')) { 20 | require $maintenance; 21 | } 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Register The Auto Loader 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Composer provides a convenient, automatically generated class loader for 29 | | this application. We just need to utilize it! We'll simply require it 30 | | into the script here so we don't need to manually load our classes. 31 | | 32 | */ 33 | 34 | require __DIR__ . '/../vendor/autoload.php'; 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Run The Application 39 | |-------------------------------------------------------------------------- 40 | | 41 | | Once we have the application, we can handle the incoming request using 42 | | the application's HTTP kernel. Then, we will send the response back 43 | | to this client's browser, allowing them to enjoy our application. 44 | | 45 | */ 46 | 47 | $app = require_once __DIR__ . '/../bootstrap/app.php'; 48 | 49 | $kernel = $app->make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/vendor/telescope/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abd-wazzan/laravel-api-boilerplate/e477b397996cf4ba19e062ae748bd204fe6f18ec/public/vendor/telescope/favicon.ico -------------------------------------------------------------------------------- /public/vendor/telescope/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/app.js": "/app.js?id=a8713c727883a44917711340bf6c817a", 3 | "/app-dark.css": "/app-dark.css?id=b44bf369e5d39f6861be639ef866bf5a", 4 | "/app.css": "/app.css?id=41c5661581f2614180d6d33c17470f08" 5 | } 6 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abd-wazzan/laravel-api-boilerplate/e477b397996cf4ba19e062ae748bd204fe6f18ec/resources/css/app.css -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * We'll load the axios HTTP library which allows us to easily issue requests 3 | * to our Laravel back-end. This library automatically handles sending the 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. 5 | */ 6 | 7 | import axios from 'axios'; 8 | window.axios = axios; 9 | 10 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 11 | 12 | /** 13 | * Echo exposes an expressive API for subscribing to channels and listening 14 | * for events that are broadcast by Laravel. Echo and event broadcasting 15 | * allows your team to easily build robust real-time web applications. 16 | */ 17 | 18 | // import Echo from 'laravel-echo'; 19 | 20 | // import Pusher from 'pusher-js'; 21 | // window.Pusher = Pusher; 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 26 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 27 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 28 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 29 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 30 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 31 | // enabledTransports: ['ws', 'wss'], 32 | // }); 33 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> 3 | <head> 4 | <meta charset="utf-8"> 5 | <meta name="viewport" content="width=device-width, initial-scale=1"> 6 | 7 | <title>Laravel 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 |
20 | @if (Route::has('login')) 21 |
22 | @auth 23 | Home 24 | @else 25 | Log in 26 | 27 | @if (Route::has('register')) 28 | Register 29 | @endif 30 | @endauth 31 |
32 | @endif 33 | 34 |
35 |
36 | 37 | 38 | 39 |
40 | 41 | 120 | 121 |
122 | 132 | 133 |
134 | Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) 135 |
136 |
137 |
138 |
139 | 140 | 141 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 16 | } 17 | 18 | /** 19 | * Register the commands for the application. 20 | */ 21 | protected function commands(): void 22 | { 23 | $this->load(__DIR__ . '/Commands'); 24 | 25 | require base_path('routes/console.php'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 18 | */ 19 | protected $levels = [ 20 | 21 | ]; 22 | 23 | /** 24 | * A list of the exception types that are not reported. 25 | * 26 | * @var array> 27 | */ 28 | protected $dontReport = [ 29 | 30 | ]; 31 | 32 | /** 33 | * A list of the inputs that are never flashed to the session on validation exceptions. 34 | * 35 | * @var array 36 | */ 37 | protected $dontFlash = [ 38 | 'current_password', 39 | 'password', 40 | 'password_confirmation', 41 | ]; 42 | 43 | /** 44 | * Register the exception handling callbacks for the application. 45 | */ 46 | public function register(): void 47 | { 48 | $this->reportable(function (Throwable $e): void { 49 | }); 50 | } 51 | 52 | public function render($request, Throwable $exception) 53 | { 54 | if ($exception instanceof ValidationException && $request->wantsJson()) { 55 | return $this->unprocessableResponse($exception->errors()); 56 | } 57 | 58 | return parent::render($request, $exception); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/Helpers/DocStrategies/ApiResponseTags.php: -------------------------------------------------------------------------------- 1 | Response::HTTP_OK, 15 | 'createdResponse' => Response::HTTP_CREATED, 16 | 'failedResponse' => Response::HTTP_BAD_REQUEST, 17 | 'unprocessableResponse' => Response::HTTP_UNPROCESSABLE_ENTITY, 18 | 'notFoundResponse' => Response::HTTP_NOT_FOUND, 19 | 'unauthorizedResponse' => Response::HTTP_UNAUTHORIZED, 20 | 'forbiddenResponse' => Response::HTTP_FORBIDDEN, 21 | 'serverErrorResponse' => Response::HTTP_INTERNAL_SERVER_ERROR, 22 | ]; 23 | 24 | public function __invoke(ExtractedEndpointData $endpointData, array $routeRules = []): ?array 25 | { 26 | $docBlocks = RouteDocBlocker::getDocBlocksFromRoute($endpointData->route); 27 | return $this->getDocBlockResponses($docBlocks['method']->getTags()); 28 | } 29 | 30 | /** 31 | * Get the response from the docblock if available. 32 | * 33 | * @param Tag[] $tags 34 | * 35 | * @return array|null 36 | */ 37 | public function getDocBlockResponses(array $tags): ?array 38 | { 39 | $responseTags = array_values( 40 | array_filter($tags, function ($tag) { 41 | return $tag instanceof Tag && $this->checkTagExistence($tag); 42 | }) 43 | ); 44 | 45 | if (empty($responseTags)) { 46 | return null; 47 | } 48 | 49 | return array_map(function (Tag $tag) { 50 | return $this->buildTagResponse($tag); 51 | }, $responseTags); 52 | } 53 | 54 | private function checkTagExistence(Tag $tag): bool 55 | { 56 | return in_array( 57 | $tag->getName(), 58 | array_keys(self::$responseTags, true), 59 | true 60 | ); 61 | } 62 | 63 | private function buildTagResponse(Tag $tag): array 64 | { 65 | $statusCode = self::$responseTags[$tag->getName()] ?? Response::HTTP_BAD_REQUEST; 66 | return [ 67 | 'content' => $this->morphMessage($statusCode), 68 | 'status' => $statusCode, 69 | 'description' => $this->getMessage($statusCode) 70 | ]; 71 | } 72 | 73 | protected function morphMessage(int $statusCode): string 74 | { 75 | return json_encode(['message' => $this->getMessage($statusCode)], JSON_THROW_ON_ERROR); 76 | } 77 | 78 | protected function getMessage(int $statusCode): string 79 | { 80 | return Response::$statusTexts[$statusCode] ?? 'unknown status'; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/app/Helpers/DocStrategies/HasPaginationParameters.php: -------------------------------------------------------------------------------- 1 | route); 14 | $tags = $docBlocks['method']->getTagsByName('usesPagination'); 15 | 16 | if (empty($tags)) { 17 | return []; 18 | } 19 | 20 | return [ 21 | 'page[number]' => [ 22 | 'description' => 'Page number to return.', 23 | 'required' => false, 24 | 'example' => 1, 25 | ], 26 | 'page[size]' => [ 27 | 'description' => "Number of items in the page.", 28 | 'required' => false, 29 | 'example' => null, // So it doesn't get included in the examples 30 | ], 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | protected $middleware = [ 21 | // \App\Http\Middleware\TrustHosts::class, 22 | \App\Http\Middleware\TrustProxies::class, 23 | \Illuminate\Http\Middleware\HandleCors::class, 24 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 25 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 26 | \App\Http\Middleware\TrimStrings::class, 27 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 28 | \App\Http\Middleware\SetLogContext::class, 29 | \App\Http\Middleware\SetLocalLanguage::class 30 | ]; 31 | 32 | /** 33 | * The application's route middleware groups. 34 | * 35 | * @var array> 36 | */ 37 | protected $middlewareGroups = [ 38 | 'web' => [ 39 | \App\Http\Middleware\EncryptCookies::class, 40 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 41 | \Illuminate\Session\Middleware\StartSession::class, 42 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 43 | \App\Http\Middleware\VerifyCsrfToken::class, 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | 47 | 'api' => [ 48 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 49 | \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api', 50 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 51 | \App\Http\Middleware\SetAcceptJsonHeader::class 52 | ], 53 | ]; 54 | 55 | /** 56 | * The application's middleware aliases. 57 | * 58 | * Aliases may be used to conveniently assign middleware to routes and groups. 59 | * 60 | * @var array 61 | */ 62 | protected $middlewareAliases = [ 63 | 'auth' => \App\Http\Middleware\Authenticate::class, 64 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 65 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 66 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 67 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 68 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 69 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 70 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 71 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 72 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 73 | ]; 74 | } 75 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson() ? null : route('login'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 24 | return redirect(RouteServiceProvider::HOME); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/SetAcceptJsonHeader.php: -------------------------------------------------------------------------------- 1 | headers->set('Accept', 'application/json'); 13 | return $next($request); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/SetLocalLanguage.php: -------------------------------------------------------------------------------- 1 | header('Accept-Language'); 13 | 14 | if ($language) { 15 | App::setLocale($language); 16 | } else { 17 | App::setLocale('en'); // Default language if Accept-Language header is missing 18 | } 19 | 20 | return $next($request); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/SetLogContext.php: -------------------------------------------------------------------------------- 1 | $requestId, 17 | 'user_id' => auth()?->user()?->getAuthIdentifier(), 18 | 'url' => $request->url(), 19 | 'body' => $request->input(), 20 | 'query' => $request->query(), 21 | 'ip' => $request->ip(), 22 | ]); 23 | 24 | $request->headers->set('Request-Id', $requestId); 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts(): array 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /src/app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /src/app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->isProduction()); 26 | 27 | Relation::morphMap([ 28 | MorphEnum::USER->value => \Domain\Client\Models\User::class, 29 | ]); 30 | 31 | $this->loadMigrationsFrom([ 32 | database_path() . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR . 'Client', 33 | ]); 34 | 35 | 36 | if ($this->app->isLocal()) { 37 | $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); 38 | $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); 39 | $this->app->register(TelescopeServiceProvider::class); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | */ 22 | public function boot(): void 23 | { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | */ 26 | public function boot(): void 27 | { 28 | } 29 | 30 | /** 31 | * Determine if events and listeners should be automatically discovered. 32 | */ 33 | public function shouldDiscoverEvents(): bool 34 | { 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 28 | 29 | $this->routes(function (): void { 30 | Route::middleware('api') 31 | ->prefix('api') 32 | ->group(base_path('routes/api.php')); 33 | 34 | Route::middleware('web') 35 | ->group(base_path('routes/web.php')); 36 | }); 37 | } 38 | 39 | /** 40 | * Configure the rate limiters for the application. 41 | */ 42 | protected function configureRateLimiting(): void 43 | { 44 | RateLimiter::for('api', function (Request $request) { 45 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/app/Providers/TelescopeServiceProvider.php: -------------------------------------------------------------------------------- 1 | hideSensitiveRequestDetails(); 20 | 21 | Telescope::filter(function (IncomingEntry $entry) { 22 | if ($this->app->environment('local')) { 23 | return true; 24 | } 25 | 26 | return $entry->isReportableException() || 27 | $entry->isFailedRequest() || 28 | $entry->isFailedJob() || 29 | $entry->isScheduledTask() || 30 | $entry->hasMonitoredTag(); 31 | }); 32 | } 33 | 34 | /** 35 | * Prevent sensitive request details from being logged by Telescope. 36 | */ 37 | protected function hideSensitiveRequestDetails(): void 38 | { 39 | if ($this->app->environment('local')) { 40 | return; 41 | } 42 | 43 | Telescope::hideRequestParameters(['_token']); 44 | 45 | Telescope::hideRequestHeaders([ 46 | 'cookie', 47 | 'x-csrf-token', 48 | 'x-xsrf-token', 49 | ]); 50 | } 51 | 52 | /** 53 | * Register the Telescope gate. 54 | * 55 | * This gate determines who can access Telescope in non-local environments. 56 | */ 57 | protected function gate(): void 58 | { 59 | Gate::define('viewTelescope', function ($user) { 60 | return in_array($user->email, [ 61 | 62 | ]); 63 | }); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/app/Traits/ApiResponseHelper.php: -------------------------------------------------------------------------------- 1 | jsonResponse( 24 | [ 25 | 'message' => $message ?? $this->morphStatusMessage($status), 26 | 'data' => $this->morphToArray($data) 27 | ], 28 | $status, 29 | $headers 30 | ); 31 | } 32 | 33 | public function createdResponse( 34 | array|Arrayable|JsonSerializable|string|null $data = [], 35 | ?string $message = null, 36 | array $headers = [] 37 | ): JsonResponse { 38 | $status = Response::HTTP_CREATED; 39 | return $this->jsonResponse( 40 | [ 41 | 'message' => $message ?? $this->morphStatusMessage($status), 42 | 'data' => $this->morphToArray($data) 43 | ], 44 | $status, 45 | $headers 46 | ); 47 | } 48 | 49 | public function failedResponse( 50 | ?string $message = null, 51 | array $headers = [] 52 | ): JsonResponse { 53 | $status = Response::HTTP_BAD_REQUEST; 54 | return $this->jsonResponse( 55 | ['message' => $message ?? $this->morphStatusMessage($status)], 56 | $status, 57 | $headers 58 | ); 59 | } 60 | 61 | public function unprocessableResponse( 62 | Throwable|array|Arrayable|JsonSerializable|string|null $errors = [], 63 | ?string $message = null, 64 | array $headers = [] 65 | ): JsonResponse { 66 | $status = Response::HTTP_UNPROCESSABLE_ENTITY; 67 | return $this->jsonResponse( 68 | [ 69 | 'message' => $message ?? $this->morphStatusMessage($status), 70 | 'errors' => $this->morphValidationErrors($errors) 71 | ], 72 | $status, 73 | $headers 74 | ); 75 | } 76 | 77 | 78 | public function notFoundResponse( 79 | ?string $message = null, 80 | array $headers = [] 81 | ): JsonResponse { 82 | $status = Response::HTTP_NOT_FOUND; 83 | return $this->jsonResponse( 84 | ['message' => $message ?? $this->morphStatusMessage($status)], 85 | $status, 86 | $headers 87 | ); 88 | } 89 | 90 | public function unauthorizedResponse( 91 | ?string $message = null, 92 | array $headers = [] 93 | ): JsonResponse { 94 | $status = Response::HTTP_UNAUTHORIZED; 95 | return $this->jsonResponse( 96 | ['message' => $message ?? $this->morphStatusMessage($status)], 97 | $status, 98 | $headers 99 | ); 100 | } 101 | 102 | public function forbiddenResponse( 103 | ?string $message = null, 104 | array $headers = [] 105 | ): JsonResponse { 106 | $status = Response::HTTP_FORBIDDEN; 107 | return $this->jsonResponse( 108 | ['message' => $message ?? $this->morphStatusMessage($status)], 109 | $status, 110 | $headers 111 | ); 112 | } 113 | 114 | public function serverErrorResponse( 115 | ?string $message = null, 116 | array $headers = [] 117 | ): JsonResponse { 118 | $status = Response::HTTP_INTERNAL_SERVER_ERROR; 119 | return $this->jsonResponse( 120 | ['message' => $message ?? $this->morphStatusMessage($status)], 121 | $status, 122 | $headers 123 | ); 124 | } 125 | 126 | 127 | private function jsonResponse(array $data, int $code = Response::HTTP_OK, $headers = []): JsonResponse 128 | { 129 | return response()->json($data, $code, $headers); 130 | } 131 | 132 | private function morphToArray(array|Arrayable|JsonSerializable|null|string $data = []): array 133 | { 134 | if (is_array($data)) { 135 | return $data; 136 | } 137 | 138 | if ($data instanceof Arrayable) { 139 | return $data->toArray(); 140 | } 141 | 142 | if ($data instanceof JsonSerializable) { 143 | return $data->jsonSerialize(); 144 | } 145 | 146 | if (is_string($data)) { 147 | return [$data]; 148 | } 149 | 150 | return []; 151 | } 152 | 153 | private function morphValidationErrors(Throwable|array|Arrayable|JsonSerializable|string|null $errors = []): array 154 | { 155 | return $errors instanceof Throwable ? [$errors->getMessage()] : $this->morphToArray($errors); 156 | } 157 | 158 | private function morphStatusMessage(int $statusCode): string 159 | { 160 | return Response::$statusTexts[$statusCode] ?? 'unknown status'; 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/domain/Client/Models/User.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | protected $fillable = [ 24 | 'name', 25 | 'email', 26 | 'password', 27 | ]; 28 | 29 | /** 30 | * The attributes that should be hidden for serialization. 31 | * 32 | * @var array 33 | */ 34 | protected $hidden = [ 35 | 'password', 36 | 'remember_token', 37 | ]; 38 | 39 | /** 40 | * The attributes that should be cast. 41 | * 42 | * @var array 43 | */ 44 | protected $casts = [ 45 | 'email_verified_at' => 'datetime', 46 | ]; 47 | 48 | protected static function newFactory() 49 | { 50 | return UserFactory::new(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/shared/Enums/MorphEnum.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 18 | 19 | return $app; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 5 | 6 | $response->assertStatus(200); 7 | }); 8 | -------------------------------------------------------------------------------- /tests/Pest.php: -------------------------------------------------------------------------------- 1 | in('Feature', 'Unit'); 12 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | toBeTrue(); 5 | }); 6 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: ['resources/css/app.css', 'resources/js/app.js'], 8 | refresh: true, 9 | }), 10 | ], 11 | }); 12 | --------------------------------------------------------------------------------