├── .editorconfig
├── .env.example
├── .env.testing
├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ └── pull-request.yml
├── .gitignore
├── README.md
├── app
├── Console
│ └── Kernel.php
├── Exceptions
│ └── Handler.php
├── Http
│ ├── Controllers
│ │ └── Controller.php
│ ├── Kernel.php
│ └── Middleware
│ │ ├── Authenticate.php
│ │ ├── EncryptCookies.php
│ │ ├── PreventRequestsDuringMaintenance.php
│ │ ├── RedirectIfAuthenticated.php
│ │ ├── TrimStrings.php
│ │ ├── TrustHosts.php
│ │ ├── TrustProxies.php
│ │ └── VerifyCsrfToken.php
├── Models
│ └── User.php
└── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── BroadcastServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── artisan
├── bootstrap
├── app.php
└── cache
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── cors.php
├── database.php
├── filesystems.php
├── hashing.php
├── ide-helper.php
├── logging.php
├── mail.php
├── queue.php
├── sanctum.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── factories
│ └── UserFactory.php
├── migrations
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ ├── 2019_08_19_000000_create_failed_jobs_table.php
│ └── 2019_12_14_000001_create_personal_access_tokens_table.php
└── seeders
│ └── DatabaseSeeder.php
├── deptrac.yaml
├── docker-compose.yml
├── docker
├── Dockerfile
├── php.ini
├── start-container
└── supervisord.conf
├── phpunit.xml
├── pint.json
├── public
├── .htaccess
├── favicon.ico
└── index.php
├── resources
└── lang
│ └── en
│ └── validation.php
├── routes
├── api.php
├── channels.php
└── console.php
├── server.php
├── src
├── Inventory
│ ├── Application
│ │ ├── Http
│ │ │ ├── Controllers
│ │ │ │ ├── .gitkeep
│ │ │ │ └── ProductController.php
│ │ │ ├── Middleware
│ │ │ │ └── .gitkeep
│ │ │ ├── Requests
│ │ │ │ ├── .gitkeep
│ │ │ │ ├── StoreProductRequest.php
│ │ │ │ └── UpdateProductRequest.php
│ │ │ └── Resources
│ │ │ │ ├── .gitkeep
│ │ │ │ └── Product.php
│ │ └── Policies
│ │ │ └── .gitkeep
│ ├── Contracts
│ │ ├── DataTransferObjects
│ │ │ ├── ProductDto.php
│ │ │ └── ProductDtoOld.php
│ │ ├── Exceptions
│ │ │ ├── InactiveProductException.php
│ │ │ ├── OutOfStockException.php
│ │ │ └── ProductNotFoundException.php
│ │ └── ProductService.php
│ ├── Domain
│ │ ├── Events
│ │ │ └── .gitkeep
│ │ ├── Jobs
│ │ │ └── .gitkeep
│ │ ├── Models
│ │ │ └── Product.php
│ │ ├── Rules
│ │ │ └── .gitkeep
│ │ └── Services
│ │ │ └── .gitkeep
│ ├── Infrastructure
│ │ ├── Database
│ │ │ ├── Factories
│ │ │ │ └── ProductFactory.php
│ │ │ ├── Migrations
│ │ │ │ └── 2021_11_23_234141_create_products_table.php
│ │ │ └── Seeders
│ │ │ │ └── ProductSeeder.php
│ │ ├── Repositories
│ │ │ └── .gitkeep
│ │ └── Services
│ │ │ └── ProductService.php
│ ├── Providers
│ │ └── InventoryServiceProvider.php
│ ├── Tests
│ │ ├── Feature
│ │ │ └── Controllers
│ │ │ │ └── ProductControllerTest.php
│ │ └── Unit
│ │ │ └── .gitkeep
│ └── routes.php
├── Order
│ ├── Application
│ │ ├── Http
│ │ │ ├── Controllers
│ │ │ │ └── OrderController.php
│ │ │ ├── Middleware
│ │ │ │ └── .gitkeep
│ │ │ ├── Requests
│ │ │ │ ├── .gitkeep
│ │ │ │ └── StoreOrderRequest.php
│ │ │ └── Resources
│ │ │ │ ├── .gitkeep
│ │ │ │ └── Order.php
│ │ └── Policies
│ │ │ └── OrderPolicy.php
│ ├── Contracts
│ │ └── Events
│ │ │ └── OrderFulfilled.php
│ ├── Domain
│ │ ├── Events
│ │ │ └── .gitkeep
│ │ ├── Exceptions
│ │ │ ├── EmptyOrderException.php
│ │ │ └── TaxRateNotFoundException.php
│ │ ├── Jobs
│ │ │ └── .gitkeep
│ │ ├── Listeners
│ │ │ └── HandleOrderShipment.php
│ │ ├── Models
│ │ │ ├── Cart.php
│ │ │ ├── CartItem.php
│ │ │ ├── Enums
│ │ │ │ └── OrderStatus.php
│ │ │ ├── Order.php
│ │ │ ├── OrderHistory.php
│ │ │ ├── OrderLine.php
│ │ │ ├── OrderStatus.php
│ │ │ └── TaxRate.php
│ │ ├── Rules
│ │ │ └── .gitkeep
│ │ └── Services
│ │ │ └── .gitkeep
│ ├── Infrastructure
│ │ ├── Database
│ │ │ ├── Factories
│ │ │ │ ├── CartFactory.php
│ │ │ │ ├── CartItemFactory.php
│ │ │ │ ├── OrderFactory.php
│ │ │ │ └── TaxRateFactory.php
│ │ │ ├── Migrations
│ │ │ │ ├── 2021_11_24_093653_create_orders_table.php
│ │ │ │ ├── 2022_01_16_071834_create_carts_table.php
│ │ │ │ ├── 2022_01_16_072128_create_cart_items_table.php
│ │ │ │ ├── 2022_01_16_072812_create_order_lines_table.php
│ │ │ │ ├── 2022_01_16_073028_create_order_statuses_table.php
│ │ │ │ ├── 2022_01_16_073258_create_order_histories_table.php
│ │ │ │ ├── 2022_01_16_073648_create_tax_rates_table.php
│ │ │ │ ├── 2022_01_16_090113_add_shipping_address_id_to_orders_table.php
│ │ │ │ └── 2022_01_20_133710_remove_shipping_address_id_from_orders_table.php
│ │ │ └── Seeders
│ │ │ │ └── OrderSeeder.php
│ │ ├── Repositories
│ │ │ └── .gitkeep
│ │ └── Services
│ │ │ └── .gitkeep
│ ├── Providers
│ │ ├── AuthServiceProvider.php
│ │ ├── EventServiceProvider.php
│ │ ├── OrderServiceProvider.php
│ │ └── RouteServiceProvider.php
│ ├── Resources
│ │ └── lang
│ │ │ └── en
│ │ │ └── errors.php
│ ├── Tests
│ │ ├── Feature
│ │ │ └── Controllers
│ │ │ │ └── OrderControllerTest.php
│ │ └── Unit
│ │ │ └── .gitkeep
│ └── routes.php
├── Payment
│ ├── Application
│ │ ├── Http
│ │ │ ├── Controllers
│ │ │ │ └── .gitkeep
│ │ │ ├── Middleware
│ │ │ │ └── .gitkeep
│ │ │ ├── Requests
│ │ │ │ └── .gitkeep
│ │ │ └── Resources
│ │ │ │ └── .gitkeep
│ │ └── Policies
│ │ │ └── .gitkeep
│ ├── Contracts
│ │ ├── Exceptions
│ │ │ └── PaymentException.php
│ │ └── PaymentService.php
│ ├── Domain
│ │ ├── Events
│ │ │ └── .gitkeep
│ │ ├── Jobs
│ │ │ └── .gitkeep
│ │ ├── Models
│ │ │ └── .gitkeep
│ │ ├── Rules
│ │ │ └── .gitkeep
│ │ └── Services
│ │ │ └── .gitkeep
│ ├── Infrastructure
│ │ ├── Database
│ │ │ └── Migrations
│ │ │ │ └── 2022_01_16_085919_create_billing_addresses_table.php
│ │ ├── Repositories
│ │ │ └── .gitkeep
│ │ └── Services
│ │ │ ├── PaddlePaymentService.php
│ │ │ └── StripePaymentService.php
│ ├── Providers
│ │ └── PaymentServiceProvider.php
│ ├── Tests
│ │ ├── Feature
│ │ │ └── Controllers
│ │ │ │ └── .gitkeep
│ │ └── Unit
│ │ │ └── .gitkeep
│ └── routes.php
└── Shipping
│ ├── Application
│ ├── Http
│ │ ├── Controllers
│ │ │ └── .gitkeep
│ │ ├── Middleware
│ │ │ └── .gitkeep
│ │ ├── Requests
│ │ │ └── .gitkeep
│ │ └── Resources
│ │ │ └── .gitkeep
│ └── Policies
│ │ └── .gitkeep
│ ├── Contracts
│ └── Events
│ │ └── ParcelShipped.php
│ ├── Domain
│ ├── Events
│ │ └── .gitkeep
│ ├── Exceptions
│ │ └── .gitkeep
│ ├── Jobs
│ │ └── .gitkeep
│ ├── Listeners
│ │ └── NotifyWarehouse.php
│ ├── Models
│ │ ├── .gitkeep
│ │ └── ShippingAddress.php
│ ├── Rules
│ │ └── .gitkeep
│ └── Services
│ │ └── .gitkeep
│ ├── Infrastructure
│ ├── Database
│ │ ├── Factories
│ │ │ └── ShippingAddressFactory.php
│ │ └── Migrations
│ │ │ └── 2022_01_16_084411_create_shipping_addresses_table.php
│ ├── Repositories
│ │ └── .gitkeep
│ └── Services
│ │ └── .gitkeep
│ ├── Providers
│ ├── EventServiceProvider.php
│ └── ShippingServiceProvider.php
│ ├── Tests
│ ├── Feature
│ │ └── Controllers
│ │ │ └── .gitkeep
│ └── Unit
│ │ └── .gitkeep
│ └── routes.php
├── storage
├── app
│ ├── .gitignore
│ └── public
│ │ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ ├── .gitignore
│ │ └── data
│ │ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ ├── testing
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
└── tests
├── CreatesApplication.php
├── Pest.php
└── TestCase.php
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | insert_final_newline = true
7 | indent_style = space
8 | indent_size = 4
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
14 | [*.{yml,yaml}]
15 | indent_size = 2
16 |
17 | [docker-compose.yml]
18 | indent_size = 4
19 |
--------------------------------------------------------------------------------
/.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=mysql
13 | DB_PORT=3306
14 | DB_DATABASE=laravel
15 | DB_USERNAME=sail
16 | DB_PASSWORD=password
17 |
18 | BROADCAST_DRIVER=log
19 | CACHE_DRIVER=file
20 | FILESYSTEM_DRIVER=local
21 | QUEUE_CONNECTION=sync
22 | SESSION_DRIVER=file
23 | SESSION_LIFETIME=120
24 |
25 | REDIS_HOST=redis
26 | REDIS_PASSWORD=null
27 | REDIS_PORT=6379
28 |
29 | MAIL_MAILER=smtp
30 | MAIL_HOST=mailhog
31 | MAIL_PORT=1025
32 | MAIL_USERNAME=null
33 | MAIL_PASSWORD=null
34 | MAIL_ENCRYPTION=null
35 | MAIL_FROM_ADDRESS=null
36 | MAIL_FROM_NAME="${APP_NAME}"
37 |
38 | AWS_ACCESS_KEY_ID=
39 | AWS_SECRET_ACCESS_KEY=
40 | AWS_DEFAULT_REGION=us-east-1
41 | AWS_BUCKET=
42 | AWS_USE_PATH_STYLE_ENDPOINT=false
43 |
44 | PUSHER_APP_ID=
45 | PUSHER_APP_KEY=
46 | PUSHER_APP_SECRET=
47 | PUSHER_APP_CLUSTER=mt1
48 |
49 | # Laravel Sail
50 | APP_PORT=
51 | APP_SERVICE=app
52 | FORWARD_DB_PORT=
53 | FORWARD_TEST_DB_PORT=
54 | FORWARD_REDIS_PORT=
55 | FORWARD_MAILHOG_PORT=1025
56 | FORWARD_MAILHOG_DASHBOARD_PORT=8025
57 | SAIL_XDEBUG_MODE=coverage
58 |
--------------------------------------------------------------------------------
/.env.testing:
--------------------------------------------------------------------------------
1 | APP_KEY=base64:K3LNFxut+foe7SIjNQmmiZQLwcV/NazJHxhB4wlt9hw=
2 | DB_CONNECTION=mysql
3 | DB_HOST=mysql-test
4 | DB_PORT=3306
5 | DB_DATABASE=laravel
6 | DB_USERNAME=sail
7 | DB_PASSWORD=password
8 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 | *.js linguist-vendored
5 | CHANGELOG.md export-ignore
6 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "composer"
4 | directory: "/"
5 | schedule:
6 | interval: weekly
7 | day: monday
8 | time: "09:00"
9 | timezone: Asia/Singapore
10 | open-pull-requests-limit: 10
11 |
--------------------------------------------------------------------------------
/.github/workflows/pull-request.yml:
--------------------------------------------------------------------------------
1 | name: Pull Request
2 | on:
3 | pull_request:
4 |
5 | jobs:
6 | ci:
7 | name: Feature & Unit Tests
8 | runs-on: ubuntu-20.04
9 | env:
10 | APP_ENV: testing
11 | DB_HOST: 127.0.0.1
12 | DB_DATABASE: laravel
13 | DB_USERNAME: root
14 | DB_PASSWORD: password
15 |
16 | services:
17 | mysql:
18 | image: mysql:8.0
19 | env:
20 | MYSQL_ROOT_PASSWORD: password
21 | MYSQL_DATABASE: laravel
22 | ports:
23 | - 3306/tcp
24 | options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
25 | steps:
26 | - name: Checkout
27 | uses: actions/checkout@v2
28 | - name: Setup PHP, with composer and extensions
29 | uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
30 | with:
31 | php-version: '8.1'
32 | extensions: mbstring, mysql
33 | coverage: xdebug
34 | - name: Get composer cache directory
35 | id: composer-cache
36 | run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37 | - name: Cache composer dependencies
38 | uses: actions/cache@v2
39 | with:
40 | path: ${{ steps.composer-cache.outputs.dir }}
41 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
42 | restore-keys: ${{ runner.os }}-composer-
43 | - name: Install Composer dependencies
44 | run: composer install --no-progress --prefer-dist --optimize-autoloader
45 | - name: Run DB Migration
46 | run: php artisan migrate:fresh
47 | env:
48 | DB_PORT: ${{ job.services.mysql.ports['3306'] }}
49 | - name: Run Pint
50 | run: vendor/bin/pint
51 | - name: Commit changes
52 | uses: stefanzweifel/git-auto-commit-action@v4
53 | with:
54 | commit_message: fix code style
55 | commit_options: '--no-verify'
56 | - name: Deptrac
57 | run: vendor/bin/deptrac
58 | - name: Pest
59 | run: vendor/bin/pest --coverage --min=80
60 | env:
61 | DB_PORT: ${{ job.services.mysql.ports['3306'] }}
62 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /coverage
2 | /node_modules
3 | /public/hot
4 | /public/storage
5 | /storage/*.key
6 | /vendor
7 | .env
8 | .env.backup
9 | .phpunit.result.cache
10 | .deptrac.cache
11 | docker-compose.override.yml
12 | Homestead.json
13 | Homestead.yaml
14 | npm-debug.log
15 | yarn-error.log
16 | /.idea
17 | /.vscode
18 | _ide_helper.php
19 | _ide_helper_models.php
20 | .phpstorm.meta.php
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Modular Monolith Laravel
2 | The sample e-commerce application for Laracon Online Winter 2022.
3 | - [Laracon Video](https://youtu.be/0Rq-yHAwYjQ?t=4070)
4 | - [Slides](https://speakerdeck.com/avosalmon/modularising-the-monolith-laracon-online-winter-2022)
5 |
6 | ## System requirements
7 | Docker is installed on your machine.
8 |
9 | ## Setup local environment
10 |
11 | Copy example env file
12 | ```sh
13 | cp .env.example .env
14 | ```
15 |
16 | Start docker compose
17 | ```sh
18 | docker compose up -d
19 | ```
20 |
21 | Install composer dependencies
22 | ```sh
23 | docker compose exec app composer install
24 | ```
25 |
26 | Generate app key and places inside the .env file
27 | ```sh
28 | docker compose exec app php artisan key:generate
29 | ```
30 |
31 | Run DB migration
32 | ```sh
33 | docker compose exec app php artisan migrate:fresh --seed
34 | ```
35 |
36 | Now you can access the app via http://localhost.
37 |
38 | To stop Docker containers
39 | ```sh
40 | docker compose down
41 | ```
42 |
43 | #### Laravel Sail command (optional)
44 |
45 | This repository uses [Laravel Sail](https://laravel.com/docs/9.x/sail) for the local docker environment. You can use the `sail` command by configuring a bash alias below.
46 | ```sh
47 | alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
48 | ```
49 |
50 | The `sail` command is an shortcut for `docker compose exec app php` which runs a given command within the docker container. The `docker compose` commands in the previous section can be shortened like this.
51 |
52 | ```sh
53 | sail composer install
54 | sail artisan key:generate
55 | sail artisan migrate:fresh --seed
56 | ```
57 |
58 | ## Testing
59 | This repository uses [Pest](https://pestphp.com/) for writing tests. Pest is a testing framework with a simpler syntax like [Jest](https://jestjs.io/) and better reporting. Since it's powered by PHPUnit, it supports all the PHPUnit syntaxes as well.
60 |
61 | ### Running tests
62 |
63 | ```sh
64 | sail test
65 | ```
66 |
67 | ### Filtering tests
68 |
69 | ```sh
70 | sail test --filter OrderControllerTest
71 | ```
72 |
73 | ### Display code coverage
74 |
75 | ```sh
76 | sail test --coverage --min=80
77 | ```
78 |
79 | ## Static code analysis to enforce domain boundaries
80 | [Deptrac](https://github.com/qossmic/deptrac) is a static code analysis tool for PHP that helps you define architectual layers over classes and rules on which layer can access which layer.
81 |
82 | You can run `deptrac` with the command below.
83 | ```sh
84 | sail exec app ./vendor/bin/deptrac
85 | ```
86 |
87 | You can also visualize the dependency graph by exporting the analysis result as an image.
88 | ```sh
89 | sail exec app ./vendor/bin/deptrac --formatter=graphviz-image --output="./deptrac.png"
90 | ```
91 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')->hourly();
28 | }
29 |
30 | /**
31 | * Register the commands for the application.
32 | *
33 | * @return void
34 | */
35 | protected function commands()
36 | {
37 | $this->load(__DIR__.'/Commands');
38 |
39 | require base_path('routes/console.php');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | reportable(function (Throwable $e) {
38 | //
39 | });
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | [
33 | \App\Http\Middleware\EncryptCookies::class,
34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
35 | \Illuminate\Session\Middleware\StartSession::class,
36 | // \Illuminate\Session\Middleware\AuthenticateSession::class,
37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
38 | \App\Http\Middleware\VerifyCsrfToken::class,
39 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
40 | ],
41 |
42 | 'api' => [
43 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
44 | 'throttle:api',
45 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
46 | ],
47 | ];
48 |
49 | /**
50 | * The application's route middleware.
51 | *
52 | * These middleware may be assigned to groups or used individually.
53 | *
54 | * @var array
55 | */
56 | protected $routeMiddleware = [
57 | 'auth' => \App\Http\Middleware\Authenticate::class,
58 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class,
61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
63 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
66 | ];
67 | }
68 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | expectsJson()) {
18 | return route('login');
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
26 | return redirect(RouteServiceProvider::HOME);
27 | }
28 | }
29 |
30 | return $next($request);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrimStrings.php:
--------------------------------------------------------------------------------
1 | allSubdomainsOfApplicationUrl(),
18 | ];
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrustProxies.php:
--------------------------------------------------------------------------------
1 | 'datetime',
42 | ];
43 | }
44 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
16 | ];
17 |
18 | /**
19 | * Register any authentication / authorization services.
20 | *
21 | * @return void
22 | */
23 | public function boot()
24 | {
25 | $this->registerPolicies();
26 |
27 | //
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/Providers/BroadcastServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
19 | SendEmailVerificationNotification::class,
20 | ],
21 | ];
22 |
23 | /**
24 | * Register any events for your application.
25 | *
26 | * @return void
27 | */
28 | public function boot()
29 | {
30 | //
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | configureRateLimiting();
30 |
31 | $this->routes(function () {
32 | Route::middleware('api')
33 | ->namespace($this->namespace)
34 | ->group(base_path('routes/api.php'));
35 | });
36 | }
37 |
38 | /**
39 | * Configure the rate limiters for the application.
40 | *
41 | * @return void
42 | */
43 | protected function configureRateLimiting()
44 | {
45 | RateLimiter::for('api', function (Request $request) {
46 | return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
47 | });
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
34 |
35 | $status = $kernel->handle(
36 | $input = new Symfony\Component\Console\Input\ArgvInput,
37 | new Symfony\Component\Console\Output\ConsoleOutput
38 | );
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Shutdown The Application
43 | |--------------------------------------------------------------------------
44 | |
45 | | Once Artisan has finished running, we will fire off the shutdown events
46 | | so that any final work may be done by the application before we shut
47 | | down the process. This is the last thing to happen to the request.
48 | |
49 | */
50 |
51 | $kernel->terminate($input, $status);
52 |
53 | exit($status);
54 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | Illuminate\Contracts\Http\Kernel::class,
31 | App\Http\Kernel::class
32 | );
33 |
34 | $app->singleton(
35 | Illuminate\Contracts\Console\Kernel::class,
36 | App\Console\Kernel::class
37 | );
38 |
39 | $app->singleton(
40 | Illuminate\Contracts\Debug\ExceptionHandler::class,
41 | App\Exceptions\Handler::class
42 | );
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Return The Application
47 | |--------------------------------------------------------------------------
48 | |
49 | | This script returns the application instance. The instance is given to
50 | | the calling script so we can separate the building of the instances
51 | | from the actual running of the application and sending responses.
52 | |
53 | */
54 |
55 | return $app;
56 |
--------------------------------------------------------------------------------
/bootstrap/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "laravel/laravel",
3 | "type": "project",
4 | "description": "The Laravel Framework.",
5 | "keywords": ["framework", "laravel"],
6 | "license": "MIT",
7 | "require": {
8 | "php": "^8.1",
9 | "fruitcake/laravel-cors": "^3.0",
10 | "guzzlehttp/guzzle": "^7.0.1",
11 | "laravel/framework": "^8.65",
12 | "laravel/sanctum": "^2.11",
13 | "laravel/tinker": "^2.5"
14 | },
15 | "require-dev": {
16 | "barryvdh/laravel-ide-helper": "^2.11",
17 | "facade/ignition": "^2.5",
18 | "fakerphp/faker": "^1.9.1",
19 | "laravel/pint": "^1.2",
20 | "laravel/sail": "^1.0.1",
21 | "mockery/mockery": "^1.4.4",
22 | "nunomaduro/collision": "^5.10",
23 | "pestphp/pest": "^1.21",
24 | "pestphp/pest-plugin-faker": "^1.0",
25 | "pestphp/pest-plugin-laravel": "^1.1",
26 | "pestphp/pest-plugin-mock": "^1.0",
27 | "phpunit/phpunit": "^9.5.10",
28 | "qossmic/deptrac-shim": "^0.24.0"
29 | },
30 | "autoload": {
31 | "psr-4": {
32 | "App\\": "app/",
33 | "Laracon\\": "src/",
34 | "Database\\Factories\\": "database/factories/",
35 | "Database\\Seeders\\": "database/seeders/"
36 | }
37 | },
38 | "autoload-dev": {
39 | "psr-4": {
40 | "Tests\\": "tests/"
41 | }
42 | },
43 | "scripts": {
44 | "post-install-cmd": [
45 | "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:generate",
46 | "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:meta",
47 | "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:models --nowrite"
48 | ],
49 | "post-update-cmd": [
50 | "Illuminate\\Foundation\\ComposerScripts::postUpdate",
51 | "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:generate",
52 | "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:meta",
53 | "[ $COMPOSER_DEV_MODE -eq 0 ] || php artisan ide-helper:models --nowrite"
54 | ],
55 | "post-autoload-dump": [
56 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
57 | "@php artisan package:discover --ansi"
58 | ],
59 | "post-root-package-install": [
60 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
61 | ],
62 | "post-create-project-cmd": [
63 | "@php artisan key:generate --ansi"
64 | ]
65 | },
66 | "extra": {
67 | "laravel": {
68 | "dont-discover": []
69 | }
70 | },
71 | "config": {
72 | "optimize-autoloader": true,
73 | "preferred-install": "dist",
74 | "sort-packages": true,
75 | "allow-plugins": {
76 | "composer/package-versions-deprecated": true,
77 | "pestphp/pest-plugin": true
78 | }
79 | },
80 | "minimum-stability": "dev",
81 | "prefer-stable": true
82 | }
83 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_NAME', 'Laravel'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application Environment
21 | |--------------------------------------------------------------------------
22 | |
23 | | This value determines the "environment" your application is currently
24 | | running in. This may determine how you prefer to configure various
25 | | services the application utilizes. Set this in your ".env" file.
26 | |
27 | */
28 |
29 | 'env' => env('APP_ENV', 'production'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Debug Mode
34 | |--------------------------------------------------------------------------
35 | |
36 | | When your application is in debug mode, detailed error messages with
37 | | stack traces will be shown on every error that occurs within your
38 | | application. If disabled, a simple generic error page is shown.
39 | |
40 | */
41 |
42 | 'debug' => (bool) env('APP_DEBUG', false),
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application URL
47 | |--------------------------------------------------------------------------
48 | |
49 | | This URL is used by the console to properly generate URLs when using
50 | | the Artisan command line tool. You should set this to the root of
51 | | your application so that it is used when running Artisan tasks.
52 | |
53 | */
54 |
55 | 'url' => env('APP_URL', 'http://localhost'),
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Timezone
60 | |--------------------------------------------------------------------------
61 | |
62 | | Here you may specify the default timezone for your application, which
63 | | will be used by the PHP date and date-time functions. We have gone
64 | | ahead and set this to a sensible default for you out of the box.
65 | |
66 | */
67 |
68 | 'timezone' => 'UTC',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Application Locale Configuration
73 | |--------------------------------------------------------------------------
74 | |
75 | | The application locale determines the default locale that will be used
76 | | by the translation service provider. You are free to set this value
77 | | to any of the locales which will be supported by the application.
78 | |
79 | */
80 |
81 | 'locale' => 'en',
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Application Fallback Locale
86 | |--------------------------------------------------------------------------
87 | |
88 | | The fallback locale determines the locale to use when the current one
89 | | is not available. You may change the value to correspond to any of
90 | | the language folders that are provided through your application.
91 | |
92 | */
93 |
94 | 'fallback_locale' => 'en',
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Faker Locale
99 | |--------------------------------------------------------------------------
100 | |
101 | | This locale will be used by the Faker PHP library when generating fake
102 | | data for your database seeds. For example, this will be used to get
103 | | localized telephone numbers, street address information and more.
104 | |
105 | */
106 |
107 | 'faker_locale' => 'en_US',
108 |
109 | /*
110 | |--------------------------------------------------------------------------
111 | | Encryption Key
112 | |--------------------------------------------------------------------------
113 | |
114 | | This key is used by the Illuminate encrypter service and should be set
115 | | to a random, 32 character string, otherwise these encrypted strings
116 | | will not be safe. Please do this before deploying an application!
117 | |
118 | */
119 |
120 | 'key' => env('APP_KEY'),
121 |
122 | 'cipher' => 'AES-256-CBC',
123 |
124 | /*
125 | |--------------------------------------------------------------------------
126 | | Autoloaded Service Providers
127 | |--------------------------------------------------------------------------
128 | |
129 | | The service providers listed here will be automatically loaded on the
130 | | request to your application. Feel free to add your own services to
131 | | this array to grant expanded functionality to your applications.
132 | |
133 | */
134 |
135 | 'providers' => [
136 |
137 | /*
138 | * Laravel Framework Service Providers...
139 | */
140 | Illuminate\Auth\AuthServiceProvider::class,
141 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
142 | Illuminate\Bus\BusServiceProvider::class,
143 | Illuminate\Cache\CacheServiceProvider::class,
144 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
145 | Illuminate\Cookie\CookieServiceProvider::class,
146 | Illuminate\Database\DatabaseServiceProvider::class,
147 | Illuminate\Encryption\EncryptionServiceProvider::class,
148 | Illuminate\Filesystem\FilesystemServiceProvider::class,
149 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
150 | Illuminate\Hashing\HashServiceProvider::class,
151 | Illuminate\Mail\MailServiceProvider::class,
152 | Illuminate\Notifications\NotificationServiceProvider::class,
153 | Illuminate\Pagination\PaginationServiceProvider::class,
154 | Illuminate\Pipeline\PipelineServiceProvider::class,
155 | Illuminate\Queue\QueueServiceProvider::class,
156 | Illuminate\Redis\RedisServiceProvider::class,
157 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
158 | Illuminate\Session\SessionServiceProvider::class,
159 | Illuminate\Translation\TranslationServiceProvider::class,
160 | Illuminate\Validation\ValidationServiceProvider::class,
161 | Illuminate\View\ViewServiceProvider::class,
162 |
163 | /*
164 | * Package Service Providers...
165 | */
166 |
167 | /*
168 | * Application Service Providers...
169 | */
170 | App\Providers\AppServiceProvider::class,
171 | App\Providers\AuthServiceProvider::class,
172 | // App\Providers\BroadcastServiceProvider::class,
173 | App\Providers\EventServiceProvider::class,
174 | App\Providers\RouteServiceProvider::class,
175 |
176 | /*
177 | * Custom Service Providers
178 | */
179 | \Laracon\Inventory\Providers\InventoryServiceProvider::class,
180 | \Laracon\Order\Providers\OrderServiceProvider::class,
181 | \Laracon\Payment\Providers\PaymentServiceProvider::class,
182 | \Laracon\Shipping\Providers\ShippingServiceProvider::class,
183 | ],
184 |
185 | /*
186 | |--------------------------------------------------------------------------
187 | | Class Aliases
188 | |--------------------------------------------------------------------------
189 | |
190 | | This array of class aliases will be registered when this application
191 | | is started. However, feel free to register as many as you wish as
192 | | the aliases are "lazy" loaded so they don't hinder performance.
193 | |
194 | */
195 |
196 | 'aliases' => [
197 |
198 | 'App' => Illuminate\Support\Facades\App::class,
199 | 'Arr' => Illuminate\Support\Arr::class,
200 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
201 | 'Auth' => Illuminate\Support\Facades\Auth::class,
202 | 'Blade' => Illuminate\Support\Facades\Blade::class,
203 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
204 | 'Bus' => Illuminate\Support\Facades\Bus::class,
205 | 'Cache' => Illuminate\Support\Facades\Cache::class,
206 | 'Config' => Illuminate\Support\Facades\Config::class,
207 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
208 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
209 | 'Date' => Illuminate\Support\Facades\Date::class,
210 | 'DB' => Illuminate\Support\Facades\DB::class,
211 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
212 | 'Event' => Illuminate\Support\Facades\Event::class,
213 | 'File' => Illuminate\Support\Facades\File::class,
214 | 'Gate' => Illuminate\Support\Facades\Gate::class,
215 | 'Hash' => Illuminate\Support\Facades\Hash::class,
216 | 'Http' => Illuminate\Support\Facades\Http::class,
217 | 'Js' => Illuminate\Support\Js::class,
218 | 'Lang' => Illuminate\Support\Facades\Lang::class,
219 | 'Log' => Illuminate\Support\Facades\Log::class,
220 | 'Mail' => Illuminate\Support\Facades\Mail::class,
221 | 'Notification' => Illuminate\Support\Facades\Notification::class,
222 | 'Password' => Illuminate\Support\Facades\Password::class,
223 | 'Queue' => Illuminate\Support\Facades\Queue::class,
224 | 'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
225 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
226 | // 'Redis' => Illuminate\Support\Facades\Redis::class,
227 | 'Request' => Illuminate\Support\Facades\Request::class,
228 | 'Response' => Illuminate\Support\Facades\Response::class,
229 | 'Route' => Illuminate\Support\Facades\Route::class,
230 | 'Schema' => Illuminate\Support\Facades\Schema::class,
231 | 'Session' => Illuminate\Support\Facades\Session::class,
232 | 'Storage' => Illuminate\Support\Facades\Storage::class,
233 | 'Str' => Illuminate\Support\Str::class,
234 | 'URL' => Illuminate\Support\Facades\URL::class,
235 | 'Validator' => Illuminate\Support\Facades\Validator::class,
236 | 'View' => Illuminate\Support\Facades\View::class,
237 |
238 | ],
239 |
240 | ];
241 |
--------------------------------------------------------------------------------
/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 | ],
44 |
45 | /*
46 | |--------------------------------------------------------------------------
47 | | User Providers
48 | |--------------------------------------------------------------------------
49 | |
50 | | All authentication drivers have a user provider. This defines how the
51 | | users are actually retrieved out of your database or other storage
52 | | mechanisms used by this application to persist your user's data.
53 | |
54 | | If you have multiple user tables or models you may configure multiple
55 | | sources which represent each model / table. These sources may then
56 | | be assigned to any extra authentication guards you have defined.
57 | |
58 | | Supported: "database", "eloquent"
59 | |
60 | */
61 |
62 | 'providers' => [
63 | 'users' => [
64 | 'driver' => 'eloquent',
65 | 'model' => App\Models\User::class,
66 | ],
67 |
68 | // 'users' => [
69 | // 'driver' => 'database',
70 | // 'table' => 'users',
71 | // ],
72 | ],
73 |
74 | /*
75 | |--------------------------------------------------------------------------
76 | | Resetting Passwords
77 | |--------------------------------------------------------------------------
78 | |
79 | | You may specify multiple password reset configurations if you have more
80 | | than one user table or model in the application and you want to have
81 | | separate password reset settings based on the specific user types.
82 | |
83 | | The expire time is the number of minutes that the reset token should be
84 | | considered valid. This security feature keeps tokens short-lived so
85 | | they have less time to be guessed. You may change this as needed.
86 | |
87 | */
88 |
89 | 'passwords' => [
90 | 'users' => [
91 | 'provider' => 'users',
92 | 'table' => 'password_resets',
93 | 'expire' => 60,
94 | 'throttle' => 60,
95 | ],
96 | ],
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Password Confirmation Timeout
101 | |--------------------------------------------------------------------------
102 | |
103 | | Here you may define the amount of seconds before a password confirmation
104 | | times out and the user is prompted to re-enter their password via the
105 | | confirmation screen. By default, the timeout lasts for three hours.
106 | |
107 | */
108 |
109 | 'password_timeout' => 10800,
110 |
111 | ];
112 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'null'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Broadcast Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may define all of the broadcast connections that will be used
26 | | to broadcast events to other systems or over websockets. Samples of
27 | | each available type of connection are provided inside this array.
28 | |
29 | */
30 |
31 | 'connections' => [
32 |
33 | 'pusher' => [
34 | 'driver' => 'pusher',
35 | 'key' => env('PUSHER_APP_KEY'),
36 | 'secret' => env('PUSHER_APP_SECRET'),
37 | 'app_id' => env('PUSHER_APP_ID'),
38 | 'options' => [
39 | 'cluster' => env('PUSHER_APP_CLUSTER'),
40 | 'useTLS' => true,
41 | ],
42 | ],
43 |
44 | 'ably' => [
45 | 'driver' => 'ably',
46 | 'key' => env('ABLY_KEY'),
47 | ],
48 |
49 | 'redis' => [
50 | 'driver' => 'redis',
51 | 'connection' => 'default',
52 | ],
53 |
54 | 'log' => [
55 | 'driver' => 'log',
56 | ],
57 |
58 | 'null' => [
59 | 'driver' => 'null',
60 | ],
61 |
62 | ],
63 |
64 | ];
65 |
--------------------------------------------------------------------------------
/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 a RAM based store such as APC or Memcached, there might
103 | | be other applications utilizing the same cache. So, we'll specify a
104 | | value to get prefixed to all our keys so we can 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' => 600,
31 |
32 | 'supports_credentials' => true,
33 |
34 | ];
35 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Database Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here are each of the database connections setup for your application.
26 | | Of course, examples of configuring each database platform that is
27 | | supported by Laravel is shown below to make development simple.
28 | |
29 | |
30 | | All database work in Laravel is done through the PHP PDO facilities
31 | | so make sure you have the driver for your particular database of
32 | | choice installed on your machine before you begin development.
33 | |
34 | */
35 |
36 | 'connections' => [
37 |
38 | 'sqlite' => [
39 | 'driver' => 'sqlite',
40 | 'url' => env('DATABASE_URL'),
41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
42 | 'prefix' => '',
43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
44 | ],
45 |
46 | 'mysql' => [
47 | 'driver' => 'mysql',
48 | 'url' => env('DATABASE_URL'),
49 | 'host' => env('DB_HOST', '127.0.0.1'),
50 | 'port' => env('DB_PORT', '3306'),
51 | 'database' => env('DB_DATABASE', 'forge'),
52 | 'username' => env('DB_USERNAME', 'forge'),
53 | 'password' => env('DB_PASSWORD', ''),
54 | 'unix_socket' => env('DB_SOCKET', ''),
55 | 'charset' => 'utf8mb4',
56 | 'collation' => 'utf8mb4_unicode_ci',
57 | 'prefix' => '',
58 | 'prefix_indexes' => true,
59 | 'strict' => true,
60 | 'engine' => null,
61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([
62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
63 | ]) : [],
64 | ],
65 |
66 | 'pgsql' => [
67 | 'driver' => 'pgsql',
68 | 'url' => env('DATABASE_URL'),
69 | 'host' => env('DB_HOST', '127.0.0.1'),
70 | 'port' => env('DB_PORT', '5432'),
71 | 'database' => env('DB_DATABASE', 'forge'),
72 | 'username' => env('DB_USERNAME', 'forge'),
73 | 'password' => env('DB_PASSWORD', ''),
74 | 'charset' => 'utf8',
75 | 'prefix' => '',
76 | 'prefix_indexes' => true,
77 | 'schema' => 'public',
78 | 'sslmode' => 'prefer',
79 | ],
80 |
81 | 'sqlsrv' => [
82 | 'driver' => 'sqlsrv',
83 | 'url' => env('DATABASE_URL'),
84 | 'host' => env('DB_HOST', 'localhost'),
85 | 'port' => env('DB_PORT', '1433'),
86 | 'database' => env('DB_DATABASE', 'forge'),
87 | 'username' => env('DB_USERNAME', 'forge'),
88 | 'password' => env('DB_PASSWORD', ''),
89 | 'charset' => 'utf8',
90 | 'prefix' => '',
91 | 'prefix_indexes' => true,
92 | ],
93 |
94 | ],
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Migration Repository Table
99 | |--------------------------------------------------------------------------
100 | |
101 | | This table keeps track of all the migrations that have already run for
102 | | your application. Using this information, we can determine which of
103 | | the migrations on disk haven't actually been run in the database.
104 | |
105 | */
106 |
107 | 'migrations' => 'migrations',
108 |
109 | /*
110 | |--------------------------------------------------------------------------
111 | | Redis Databases
112 | |--------------------------------------------------------------------------
113 | |
114 | | Redis is an open source, fast, and advanced key-value store that also
115 | | provides a richer body of commands than a typical key-value system
116 | | such as APC or Memcached. Laravel makes it easy to dig right in.
117 | |
118 | */
119 |
120 | 'redis' => [
121 |
122 | 'client' => env('REDIS_CLIENT', 'phpredis'),
123 |
124 | 'options' => [
125 | 'cluster' => env('REDIS_CLUSTER', 'redis'),
126 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
127 | ],
128 |
129 | 'default' => [
130 | 'url' => env('REDIS_URL'),
131 | 'host' => env('REDIS_HOST', '127.0.0.1'),
132 | 'password' => env('REDIS_PASSWORD', null),
133 | 'port' => env('REDIS_PORT', '6379'),
134 | 'database' => env('REDIS_DB', '0'),
135 | ],
136 |
137 | 'cache' => [
138 | 'url' => env('REDIS_URL'),
139 | 'host' => env('REDIS_HOST', '127.0.0.1'),
140 | 'password' => env('REDIS_PASSWORD', null),
141 | 'port' => env('REDIS_PORT', '6379'),
142 | 'database' => env('REDIS_CACHE_DB', '1'),
143 | ],
144 |
145 | ],
146 |
147 | ];
148 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | env('FILESYSTEM_DRIVER', 'local'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | 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 setup for each driver as an example of the required options.
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 | ],
37 |
38 | 'public' => [
39 | 'driver' => 'local',
40 | 'root' => storage_path('app/public'),
41 | 'url' => env('APP_URL').'/storage',
42 | 'visibility' => 'public',
43 | ],
44 |
45 | 's3' => [
46 | 'driver' => 's3',
47 | 'key' => env('AWS_ACCESS_KEY_ID'),
48 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
49 | 'region' => env('AWS_DEFAULT_REGION'),
50 | 'bucket' => env('AWS_BUCKET'),
51 | 'url' => env('AWS_URL'),
52 | 'endpoint' => env('AWS_ENDPOINT'),
53 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
54 | ],
55 |
56 | ],
57 |
58 | /*
59 | |--------------------------------------------------------------------------
60 | | Symbolic Links
61 | |--------------------------------------------------------------------------
62 | |
63 | | Here you may configure the symbolic links that will be created when the
64 | | `storage:link` Artisan command is executed. The array keys should be
65 | | the locations of the links and the values should be their targets.
66 | |
67 | */
68 |
69 | 'links' => [
70 | public_path('storage') => storage_path('app/public'),
71 | ],
72 |
73 | ];
74 |
--------------------------------------------------------------------------------
/config/hashing.php:
--------------------------------------------------------------------------------
1 | 'bcrypt',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Bcrypt Options
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may specify the configuration options that should be used when
26 | | passwords are hashed using the Bcrypt algorithm. This will allow you
27 | | to control the amount of time it takes to hash the given password.
28 | |
29 | */
30 |
31 | 'bcrypt' => [
32 | 'rounds' => env('BCRYPT_ROUNDS', 10),
33 | ],
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Argon Options
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here you may specify the configuration options that should be used when
41 | | passwords are hashed using the Argon algorithm. These will allow you
42 | | to control the amount of time it takes to hash the given password.
43 | |
44 | */
45 |
46 | 'argon' => [
47 | 'memory' => 1024,
48 | 'threads' => 2,
49 | 'time' => 2,
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/config/ide-helper.php:
--------------------------------------------------------------------------------
1 | '_ide_helper.php',
15 |
16 | /*
17 | |--------------------------------------------------------------------------
18 | | Models filename
19 | |--------------------------------------------------------------------------
20 | |
21 | | The default filename for the models helper file
22 | |
23 | */
24 |
25 | 'models_filename' => '_ide_helper_models.php',
26 |
27 | /*
28 | |--------------------------------------------------------------------------
29 | | Where to write the PhpStorm specific meta file
30 | |--------------------------------------------------------------------------
31 | |
32 | | PhpStorm also supports the directory `.phpstorm.meta.php/` with arbitrary
33 | | files in it, should you need additional files for your project; e.g.
34 | | `.phpstorm.meta.php/laravel_ide_Helper.php'.
35 | |
36 | */
37 | 'meta_filename' => '.phpstorm.meta.php',
38 |
39 | /*
40 | |--------------------------------------------------------------------------
41 | | Fluent helpers
42 | |--------------------------------------------------------------------------
43 | |
44 | | Set to true to generate commonly used Fluent methods
45 | |
46 | */
47 |
48 | 'include_fluent' => false,
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | Factory Builders
53 | |--------------------------------------------------------------------------
54 | |
55 | | Set to true to generate factory generators for better factory()
56 | | method auto-completion.
57 | |
58 | | Deprecated for Laravel 8 or latest.
59 | |
60 | */
61 |
62 | 'include_factory_builders' => false,
63 |
64 | /*
65 | |--------------------------------------------------------------------------
66 | | Write Model Magic methods
67 | |--------------------------------------------------------------------------
68 | |
69 | | Set to false to disable write magic methods of model
70 | |
71 | */
72 |
73 | 'write_model_magic_where' => true,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Write Model External Eloquent Builder methods
78 | |--------------------------------------------------------------------------
79 | |
80 | | Set to false to disable write external eloquent builder methods
81 | |
82 | */
83 |
84 | 'write_model_external_builder_methods' => true,
85 |
86 | /*
87 | |--------------------------------------------------------------------------
88 | | Write Model relation count properties
89 | |--------------------------------------------------------------------------
90 | |
91 | | Set to false to disable writing of relation count properties to model DocBlocks.
92 | |
93 | */
94 |
95 | 'write_model_relation_count_properties' => true,
96 |
97 | /*
98 | |--------------------------------------------------------------------------
99 | | Write Eloquent Model Mixins
100 | |--------------------------------------------------------------------------
101 | |
102 | | This will add the necessary DocBlock mixins to the model class
103 | | contained in the Laravel Framework. This helps the IDE with
104 | | auto-completion.
105 | |
106 | | Please be aware that this setting changes a file within the /vendor directory.
107 | |
108 | */
109 |
110 | 'write_eloquent_model_mixins' => false,
111 |
112 | /*
113 | |--------------------------------------------------------------------------
114 | | Helper files to include
115 | |--------------------------------------------------------------------------
116 | |
117 | | Include helper files. By default not included, but can be toggled with the
118 | | -- helpers (-H) option. Extra helper files can be included.
119 | |
120 | */
121 |
122 | 'include_helpers' => false,
123 |
124 | 'helper_files' => [
125 | base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
126 | ],
127 |
128 | /*
129 | |--------------------------------------------------------------------------
130 | | Model locations to include
131 | |--------------------------------------------------------------------------
132 | |
133 | | Define in which directories the ide-helper:models command should look
134 | | for models.
135 | |
136 | | glob patterns are supported to easier reach models in sub-directories,
137 | | e.g. `app/Services/* /Models` (without the space)
138 | |
139 | */
140 |
141 | 'model_locations' => [
142 | 'app',
143 | 'src/Inventory/Domain/Models',
144 | 'src/Order/Domain/Models',
145 | 'src/Payment/Domain/Models',
146 | 'src/Shipping/Domain/Models',
147 | ],
148 |
149 | /*
150 | |--------------------------------------------------------------------------
151 | | Models to ignore
152 | |--------------------------------------------------------------------------
153 | |
154 | | Define which models should be ignored.
155 | |
156 | */
157 |
158 | 'ignored_models' => [
159 |
160 | ],
161 |
162 | /*
163 | |--------------------------------------------------------------------------
164 | | Models hooks
165 | |--------------------------------------------------------------------------
166 | |
167 | | Define which hook classes you want to run for models to add custom information
168 | |
169 | | Hooks should implement Barryvdh\LaravelIdeHelper\Contracts\ModelHookInterface.
170 | |
171 | */
172 |
173 | 'model_hooks' => [
174 | // App\Support\IdeHelper\MyModelHook::class
175 | ],
176 |
177 | /*
178 | |--------------------------------------------------------------------------
179 | | Extra classes
180 | |--------------------------------------------------------------------------
181 | |
182 | | These implementations are not really extended, but called with magic functions
183 | |
184 | */
185 |
186 | 'extra' => [
187 | 'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'],
188 | 'Session' => ['Illuminate\Session\Store'],
189 | ],
190 |
191 | 'magic' => [],
192 |
193 | /*
194 | |--------------------------------------------------------------------------
195 | | Interface implementations
196 | |--------------------------------------------------------------------------
197 | |
198 | | These interfaces will be replaced with the implementing class. Some interfaces
199 | | are detected by the helpers, others can be listed below.
200 | |
201 | */
202 |
203 | 'interfaces' => [
204 |
205 | ],
206 |
207 | /*
208 | |--------------------------------------------------------------------------
209 | | Support for custom DB types
210 | |--------------------------------------------------------------------------
211 | |
212 | | This setting allow you to map any custom database type (that you may have
213 | | created using CREATE TYPE statement or imported using database plugin
214 | | / extension to a Doctrine type.
215 | |
216 | | Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are:
217 | | 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql'
218 | |
219 | | This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant
220 | |
221 | | The value of the array is an array of type mappings. Key is the name of the custom type,
222 | | (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in
223 | | our case it is 'json_array'. Doctrine types are listed here:
224 | | https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#types
225 | |
226 | | So to support jsonb in your models when working with Postgres, just add the following entry to the array below:
227 | |
228 | | "postgresql" => array(
229 | | "jsonb" => "json_array",
230 | | ),
231 | |
232 | */
233 | 'custom_db_types' => [
234 |
235 | ],
236 |
237 | /*
238 | |--------------------------------------------------------------------------
239 | | Support for camel cased models
240 | |--------------------------------------------------------------------------
241 | |
242 | | There are some Laravel packages (such as Eloquence) that allow for accessing
243 | | Eloquent model properties via camel case, instead of snake case.
244 | |
245 | | Enabling this option will support these packages by saving all model
246 | | properties as camel case, instead of snake case.
247 | |
248 | | For example, normally you would see this:
249 | |
250 | | * @property \Illuminate\Support\Carbon $created_at
251 | | * @property \Illuminate\Support\Carbon $updated_at
252 | |
253 | | With this enabled, the properties will be this:
254 | |
255 | | * @property \Illuminate\Support\Carbon $createdAt
256 | | * @property \Illuminate\Support\Carbon $updatedAt
257 | |
258 | | Note, it is currently an all-or-nothing option.
259 | |
260 | */
261 | 'model_camel_case_properties' => false,
262 |
263 | /*
264 | |--------------------------------------------------------------------------
265 | | Property Casts
266 | |--------------------------------------------------------------------------
267 | |
268 | | Cast the given "real type" to the given "type".
269 | |
270 | */
271 | 'type_overrides' => [
272 | 'integer' => 'int',
273 | 'boolean' => 'bool',
274 | ],
275 |
276 | /*
277 | |--------------------------------------------------------------------------
278 | | Include DocBlocks from classes
279 | |--------------------------------------------------------------------------
280 | |
281 | | Include DocBlocks from classes to allow additional code inspection for
282 | | magic methods and properties.
283 | |
284 | */
285 | 'include_class_docblocks' => false,
286 |
287 | /*
288 | |--------------------------------------------------------------------------
289 | | Force FQN usage
290 | |--------------------------------------------------------------------------
291 | |
292 | | Use the fully qualified (class) name in docBlock,
293 | | event if class exists in a given file
294 | | or there is an import (use className) of a given class
295 | |
296 | */
297 | 'force_fqn' => false,
298 |
299 | /*
300 | |--------------------------------------------------------------------------
301 | | Additional relation types
302 | |--------------------------------------------------------------------------
303 | |
304 | | Sometimes it's needed to create custom relation types. The key of the array
305 | | is the Relationship Method name. The value of the array is the canonical class
306 | | name of the Relationship, e.g. `'relationName' => RelationShipClass::class`.
307 | |
308 | */
309 | 'additional_relation_types' => [],
310 |
311 | /*
312 | |--------------------------------------------------------------------------
313 | | Run artisan commands after migrations to generate model helpers
314 | |--------------------------------------------------------------------------
315 | |
316 | | The specified commands should run after migrations are finished running.
317 | |
318 | */
319 | 'post_migrate' => [
320 | // 'ide-helper:models --nowrite',
321 | ],
322 |
323 | ];
324 |
--------------------------------------------------------------------------------
/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' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Log Channels
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here you may configure the log channels for your application. Out of
41 | | the box, Laravel uses the Monolog PHP logging library. This gives
42 | | you a variety of powerful log handlers / formatters to utilize.
43 | |
44 | | Available Drivers: "single", "daily", "slack", "syslog",
45 | | "errorlog", "monolog",
46 | | "custom", "stack"
47 | |
48 | */
49 |
50 | 'channels' => [
51 | 'stack' => [
52 | 'driver' => 'stack',
53 | 'channels' => ['single'],
54 | 'ignore_exceptions' => false,
55 | ],
56 |
57 | 'single' => [
58 | 'driver' => 'single',
59 | 'path' => storage_path('logs/laravel.log'),
60 | 'level' => env('LOG_LEVEL', 'debug'),
61 | ],
62 |
63 | 'daily' => [
64 | 'driver' => 'daily',
65 | 'path' => storage_path('logs/laravel.log'),
66 | 'level' => env('LOG_LEVEL', 'debug'),
67 | 'days' => 14,
68 | ],
69 |
70 | 'slack' => [
71 | 'driver' => 'slack',
72 | 'url' => env('LOG_SLACK_WEBHOOK_URL'),
73 | 'username' => 'Laravel Log',
74 | 'emoji' => ':boom:',
75 | 'level' => env('LOG_LEVEL', 'critical'),
76 | ],
77 |
78 | 'papertrail' => [
79 | 'driver' => 'monolog',
80 | 'level' => env('LOG_LEVEL', 'debug'),
81 | 'handler' => SyslogUdpHandler::class,
82 | 'handler_with' => [
83 | 'host' => env('PAPERTRAIL_URL'),
84 | 'port' => env('PAPERTRAIL_PORT'),
85 | ],
86 | ],
87 |
88 | 'stderr' => [
89 | 'driver' => 'monolog',
90 | 'level' => env('LOG_LEVEL', 'debug'),
91 | 'handler' => StreamHandler::class,
92 | 'formatter' => env('LOG_STDERR_FORMATTER'),
93 | 'with' => [
94 | 'stream' => 'php://stderr',
95 | ],
96 | ],
97 |
98 | 'syslog' => [
99 | 'driver' => 'syslog',
100 | 'level' => env('LOG_LEVEL', 'debug'),
101 | ],
102 |
103 | 'errorlog' => [
104 | 'driver' => 'errorlog',
105 | 'level' => env('LOG_LEVEL', 'debug'),
106 | ],
107 |
108 | 'null' => [
109 | 'driver' => 'monolog',
110 | 'handler' => NullHandler::class,
111 | ],
112 |
113 | 'emergency' => [
114 | 'path' => storage_path('logs/laravel.log'),
115 | ],
116 | ],
117 |
118 | ];
119 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_MAILER', 'smtp'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Mailer Configurations
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure all of the mailers used by your application plus
24 | | their respective settings. Several examples have been configured for
25 | | you and you are free to add your own as your application requires.
26 | |
27 | | Laravel supports a variety of mail "transport" drivers to be used while
28 | | sending an e-mail. You will specify which one you are using for your
29 | | mailers below. You are free to add additional mailers as required.
30 | |
31 | | Supported: "smtp", "sendmail", "mailgun", "ses",
32 | | "postmark", "log", "array", "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 | 'auth_mode' => null,
46 | ],
47 |
48 | 'ses' => [
49 | 'transport' => 'ses',
50 | ],
51 |
52 | 'mailgun' => [
53 | 'transport' => 'mailgun',
54 | ],
55 |
56 | 'postmark' => [
57 | 'transport' => 'postmark',
58 | ],
59 |
60 | 'sendmail' => [
61 | 'transport' => 'sendmail',
62 | 'path' => '/usr/sbin/sendmail -bs',
63 | ],
64 |
65 | 'log' => [
66 | 'transport' => 'log',
67 | 'channel' => env('MAIL_LOG_CHANNEL'),
68 | ],
69 |
70 | 'array' => [
71 | 'transport' => 'array',
72 | ],
73 |
74 | 'failover' => [
75 | 'transport' => 'failover',
76 | 'mailers' => [
77 | 'smtp',
78 | 'log',
79 | ],
80 | ],
81 | ],
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Global "From" Address
86 | |--------------------------------------------------------------------------
87 | |
88 | | You may wish for all e-mails sent by your application to be sent from
89 | | the same address. Here, you may specify a name and address that is
90 | | used globally for all e-mails that are sent by your application.
91 | |
92 | */
93 |
94 | 'from' => [
95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
96 | 'name' => env('MAIL_FROM_NAME', 'Example'),
97 | ],
98 |
99 | /*
100 | |--------------------------------------------------------------------------
101 | | Markdown Mail Settings
102 | |--------------------------------------------------------------------------
103 | |
104 | | If you are using Markdown based email rendering, you may configure your
105 | | theme and component paths here, allowing you to customize the design
106 | | of the emails. Or, you may simply stick with the Laravel defaults!
107 | |
108 | */
109 |
110 | 'markdown' => [
111 | 'theme' => 'default',
112 |
113 | 'paths' => [
114 | resource_path('views/vendor/mail'),
115 | ],
116 | ],
117 |
118 | ];
119 |
--------------------------------------------------------------------------------
/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/sanctum.php:
--------------------------------------------------------------------------------
1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
17 | '%s%s',
18 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
19 | env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''
20 | ))),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Sanctum Guards
25 | |--------------------------------------------------------------------------
26 | |
27 | | This array contains the authentication guards that will be checked when
28 | | Sanctum is trying to authenticate a request. If none of these guards
29 | | are able to authenticate the request, Sanctum will use the bearer
30 | | token that's present on an incoming request for authentication.
31 | |
32 | */
33 |
34 | 'guard' => ['web'],
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Expiration Minutes
39 | |--------------------------------------------------------------------------
40 | |
41 | | This value controls the number of minutes until an issued token will be
42 | | considered expired. If this value is null, personal access tokens do
43 | | not expire. This won't tweak the lifetime of first-party sessions.
44 | |
45 | */
46 |
47 | 'expiration' => null,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Sanctum Middleware
52 | |--------------------------------------------------------------------------
53 | |
54 | | When authenticating your first-party SPA with Sanctum you may need to
55 | | customize some of the middleware Sanctum uses while processing the
56 | | request. You may change the middleware listed below as required.
57 | |
58 | */
59 |
60 | 'middleware' => [
61 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
62 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
63 | ],
64 |
65 | ];
66 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
21 | ],
22 |
23 | 'postmark' => [
24 | 'token' => env('POSTMARK_TOKEN'),
25 | ],
26 |
27 | 'ses' => [
28 | 'key' => env('AWS_ACCESS_KEY_ID'),
29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
31 | ],
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Session Lifetime
26 | |--------------------------------------------------------------------------
27 | |
28 | | Here you may specify the number of minutes that you wish the session
29 | | to be allowed to remain idle before it expires. If you want them
30 | | to immediately expire on the browser closing, set that option.
31 | |
32 | */
33 |
34 | 'lifetime' => env('SESSION_LIFETIME', 120),
35 |
36 | 'expire_on_close' => false,
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Session Encryption
41 | |--------------------------------------------------------------------------
42 | |
43 | | This option allows you to easily specify that all of your session data
44 | | should be encrypted before it is stored. All encryption will be run
45 | | automatically by Laravel and you can use the Session like normal.
46 | |
47 | */
48 |
49 | 'encrypt' => false,
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | Session File Location
54 | |--------------------------------------------------------------------------
55 | |
56 | | When using the native session driver, we need a location where session
57 | | files may be stored. A default has been set for you but a different
58 | | location may be specified. This is only needed for file sessions.
59 | |
60 | */
61 |
62 | 'files' => storage_path('framework/sessions'),
63 |
64 | /*
65 | |--------------------------------------------------------------------------
66 | | Session Database Connection
67 | |--------------------------------------------------------------------------
68 | |
69 | | When using the "database" or "redis" session drivers, you may specify a
70 | | connection that should be used to manage these sessions. This should
71 | | correspond to a connection in your database configuration options.
72 | |
73 | */
74 |
75 | 'connection' => env('SESSION_CONNECTION', null),
76 |
77 | /*
78 | |--------------------------------------------------------------------------
79 | | Session Database Table
80 | |--------------------------------------------------------------------------
81 | |
82 | | When using the "database" session driver, you may specify the table we
83 | | should use to manage the sessions. Of course, a sensible default is
84 | | provided for you; however, you are free to change this as needed.
85 | |
86 | */
87 |
88 | 'table' => 'sessions',
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Session Cache Store
93 | |--------------------------------------------------------------------------
94 | |
95 | | While using one of the framework's cache driven session backends you may
96 | | list a cache store that should be used for these sessions. This value
97 | | must match with one of the application's configured cache "stores".
98 | |
99 | | Affects: "apc", "dynamodb", "memcached", "redis"
100 | |
101 | */
102 |
103 | 'store' => env('SESSION_STORE', null),
104 |
105 | /*
106 | |--------------------------------------------------------------------------
107 | | Session Sweeping Lottery
108 | |--------------------------------------------------------------------------
109 | |
110 | | Some session drivers must manually sweep their storage location to get
111 | | rid of old sessions from storage. Here are the chances that it will
112 | | happen on a given request. By default, the odds are 2 out of 100.
113 | |
114 | */
115 |
116 | 'lottery' => [2, 100],
117 |
118 | /*
119 | |--------------------------------------------------------------------------
120 | | Session Cookie Name
121 | |--------------------------------------------------------------------------
122 | |
123 | | Here you may change the name of the cookie used to identify a session
124 | | instance by ID. The name specified here will get used every time a
125 | | new session cookie is created by the framework for every driver.
126 | |
127 | */
128 |
129 | 'cookie' => env(
130 | 'SESSION_COOKIE',
131 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
132 | ),
133 |
134 | /*
135 | |--------------------------------------------------------------------------
136 | | Session Cookie Path
137 | |--------------------------------------------------------------------------
138 | |
139 | | The session cookie path determines the path for which the cookie will
140 | | be regarded as available. Typically, this will be the root path of
141 | | your application but you are free to change this when necessary.
142 | |
143 | */
144 |
145 | 'path' => '/',
146 |
147 | /*
148 | |--------------------------------------------------------------------------
149 | | Session Cookie Domain
150 | |--------------------------------------------------------------------------
151 | |
152 | | Here you may change the domain of the cookie used to identify a session
153 | | in your application. This will determine which domains the cookie is
154 | | available to in your application. A sensible default has been set.
155 | |
156 | */
157 |
158 | 'domain' => env('SESSION_DOMAIN', null),
159 |
160 | /*
161 | |--------------------------------------------------------------------------
162 | | HTTPS Only Cookies
163 | |--------------------------------------------------------------------------
164 | |
165 | | By setting this option to true, session cookies will only be sent back
166 | | to the server if the browser has a HTTPS connection. This will keep
167 | | the cookie from being sent to you 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/view.php:
--------------------------------------------------------------------------------
1 | [
17 | resource_path('views'),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => env(
32 | 'VIEW_COMPILED_PATH',
33 | realpath(storage_path('framework/views'))
34 | ),
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite*
2 |
--------------------------------------------------------------------------------
/database/factories/UserFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->name(),
19 | 'email' => $this->faker->unique()->safeEmail(),
20 | 'email_verified_at' => now(),
21 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
22 | 'remember_token' => Str::random(10),
23 | ];
24 | }
25 |
26 | /**
27 | * Indicate that the model's email address should be unverified.
28 | *
29 | * @return \Illuminate\Database\Eloquent\Factories\Factory
30 | */
31 | public function unverified()
32 | {
33 | return $this->state(function (array $attributes) {
34 | return [
35 | 'email_verified_at' => null,
36 | ];
37 | });
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->timestamp('email_verified_at')->nullable();
21 | $table->string('password');
22 | $table->rememberToken();
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('users');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
18 | $table->string('token');
19 | $table->timestamp('created_at')->nullable();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('password_resets');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2019_08_19_000000_create_failed_jobs_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('uuid')->unique();
19 | $table->text('connection');
20 | $table->text('queue');
21 | $table->longText('payload');
22 | $table->longText('exception');
23 | $table->timestamp('failed_at')->useCurrent();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('failed_jobs');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->morphs('tokenable');
19 | $table->string('name');
20 | $table->string('token', 64)->unique();
21 | $table->text('abilities')->nullable();
22 | $table->timestamp('last_used_at')->nullable();
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('personal_access_tokens');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/seeders/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | create();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/deptrac.yaml:
--------------------------------------------------------------------------------
1 | parameters:
2 | paths:
3 | - ./src
4 | - ./app
5 | layers:
6 | - name: Common
7 | collectors:
8 | - type: directory
9 | regex: ./app/.*
10 | - name: Contracts
11 | collectors:
12 | - type: directory
13 | regex: .*/Contracts/.*
14 | - name: Vendor
15 | collectors:
16 | - type: bool
17 | must_not:
18 | - type: directory
19 | regex: ./(src|app)/.*
20 | - name: Inventory
21 | collectors:
22 | - type: bool
23 | must:
24 | - type: directory
25 | regex: ./src/Inventory/.*
26 | must_not:
27 | - type: directory
28 | regex: ./src/Inventory/Contracts/.*
29 | - name: Order
30 | collectors:
31 | - type: bool
32 | must:
33 | - type: directory
34 | regex: ./src/Order/.*
35 | must_not:
36 | - type: directory
37 | regex: ./src/Order/Contracts/.*
38 | - name: Payment
39 | collectors:
40 | - type: bool
41 | must:
42 | - type: directory
43 | regex: ./src/Payment/.*
44 | must_not:
45 | - type: directory
46 | regex: ./src/Payment/Contracts/.*
47 | - name: Shipping
48 | collectors:
49 | - type: bool
50 | must:
51 | - type: directory
52 | regex: ./src/Shipping/.*
53 | must_not:
54 | - type: directory
55 | regex: ./src/Shipping/Contracts/.*
56 | ruleset:
57 | Common:
58 | - Vendor
59 | Contracts:
60 | - Vendor
61 | - Common
62 | Inventory:
63 | - Contracts
64 | - Vendor
65 | - Common
66 | Order:
67 | - Contracts
68 | - Vendor
69 | - Common
70 | Payment:
71 | - Contracts
72 | - Vendor
73 | - Common
74 | Shipping:
75 | - Contracts
76 | - Vendor
77 | - Common
78 | # formatters config is required to generate graphical diagrams using graphviz.
79 | # Default values should be used according to https://github.com/qossmic/deptrac/issues/949,
80 | # however, the command still fails if no formatters config is specified.
81 | formatters:
82 | graphviz:
83 | hidden_layers: []
84 | groups: []
85 | point_to_groups: false
86 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # For more information: https://laravel.com/docs/sail
2 | version: '3'
3 | services:
4 | app:
5 | build:
6 | context: ./docker
7 | dockerfile: Dockerfile
8 | args:
9 | WWWGROUP: '${WWWGROUP:-1000}'
10 | image: sail-8.1/app
11 | extra_hosts:
12 | - 'host.docker.internal:host-gateway'
13 | ports:
14 | - '${APP_PORT:-80}:80'
15 | environment:
16 | WWWUSER: '${WWWUSER:-1000}'
17 | LARAVEL_SAIL: 1
18 | XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-coverage}'
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 | mysql:
28 | image: 'mysql/mysql-server:8.0'
29 | ports:
30 | - '${FORWARD_DB_PORT:-3306}:3306'
31 | environment:
32 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
33 | MYSQL_ROOT_HOST: "%"
34 | MYSQL_DATABASE: '${DB_DATABASE}'
35 | MYSQL_USER: '${DB_USERNAME}'
36 | MYSQL_PASSWORD: '${DB_PASSWORD}'
37 | MYSQL_ALLOW_EMPTY_PASSWORD: 1
38 | volumes:
39 | - 'sailmysql:/var/lib/mysql'
40 | networks:
41 | - sail
42 | healthcheck:
43 | test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
44 | retries: 3
45 | timeout: 5s
46 | mysql-test:
47 | image: 'mysql/mysql-server:8.0'
48 | ports:
49 | - '${FORWARD_TEST_DB_PORT:-3306}:3306'
50 | environment:
51 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
52 | MYSQL_ROOT_HOST: "%"
53 | MYSQL_DATABASE: '${DB_DATABASE}'
54 | MYSQL_USER: '${DB_USERNAME}'
55 | MYSQL_PASSWORD: '${DB_PASSWORD}'
56 | MYSQL_ALLOW_EMPTY_PASSWORD: 1
57 | networks:
58 | - sail
59 | healthcheck:
60 | test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
61 | retries: 3
62 | timeout: 5s
63 | redis:
64 | image: 'redis:alpine'
65 | ports:
66 | - '${FORWARD_REDIS_PORT:-6379}:6379'
67 | volumes:
68 | - 'sailredis:/data'
69 | networks:
70 | - sail
71 | healthcheck:
72 | test: ["CMD", "redis-cli", "ping"]
73 | retries: 3
74 | timeout: 5s
75 | mailhog:
76 | image: 'mailhog/mailhog:latest'
77 | ports:
78 | - '${FORWARD_MAILHOG_PORT:-1025}:1025'
79 | - '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025'
80 | networks:
81 | - sail
82 | networks:
83 | sail:
84 | driver: bridge
85 | volumes:
86 | sailmysql:
87 | driver: local
88 | sailredis:
89 | driver: local
90 |
--------------------------------------------------------------------------------
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:22.04
2 |
3 | LABEL maintainer="Taylor Otwell"
4 |
5 | ARG WWWGROUP
6 | ARG NODE_VERSION=16
7 | ARG POSTGRES_VERSION=14
8 |
9 | WORKDIR /var/www/html
10 |
11 | ENV DEBIAN_FRONTEND noninteractive
12 | ENV TZ=UTC
13 |
14 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
15 |
16 | RUN apt-get update \
17 | && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
18 | && mkdir -p ~/.gnupg \
19 | && chmod 600 ~/.gnupg \
20 | && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
21 | && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf \
22 | && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c \
23 | && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg \
24 | && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
25 | && apt-get update \
26 | && apt-get install -y php8.1-cli php8.1-dev \
27 | php8.1-pgsql php8.1-sqlite3 php8.1-gd \
28 | php8.1-curl \
29 | php8.1-imap php8.1-mysql php8.1-mbstring \
30 | php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
31 | php8.1-intl php8.1-readline \
32 | php8.1-ldap \
33 | php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
34 | php8.1-memcached php8.1-pcov php8.1-xdebug \
35 | && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
36 | && apt-get install -y graphviz \
37 | && curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
38 | && apt-get install -y nodejs \
39 | && npm install -g npm \
40 | && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \
41 | && echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
42 | && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
43 | && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
44 | && apt-get update \
45 | && apt-get install -y yarn \
46 | && apt-get install -y mysql-client \
47 | && apt-get install -y postgresql-client-$POSTGRES_VERSION \
48 | && apt-get -y autoremove \
49 | && apt-get clean \
50 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
51 |
52 | RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
53 |
54 | RUN groupadd --force -g $WWWGROUP sail
55 | RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
56 |
57 | COPY start-container /usr/local/bin/start-container
58 | COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
59 | COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
60 | RUN chmod +x /usr/local/bin/start-container
61 |
62 | EXPOSE 8000
63 |
64 | ENTRYPOINT ["start-container"]
65 |
--------------------------------------------------------------------------------
/docker/php.ini:
--------------------------------------------------------------------------------
1 | [PHP]
2 | post_max_size = 100M
3 | upload_max_filesize = 100M
4 | variables_order = EGPCS
5 |
--------------------------------------------------------------------------------
/docker/start-container:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | if [ ! -z "$WWWUSER" ]; then
4 | usermod -u $WWWUSER sail
5 | fi
6 |
7 | if [ ! -d /.composer ]; then
8 | mkdir /.composer
9 | fi
10 |
11 | chmod -R ugo+rw /.composer
12 |
13 | if [ $# -gt 0 ]; then
14 | exec gosu $WWWUSER "$@"
15 | else
16 | exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
17 | fi
18 |
--------------------------------------------------------------------------------
/docker/supervisord.conf:
--------------------------------------------------------------------------------
1 | [supervisord]
2 | nodaemon=true
3 | user=root
4 | logfile=/var/log/supervisor/supervisord.log
5 | pidfile=/var/run/supervisord.pid
6 |
7 | [program:php]
8 | command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
9 | user=sail
10 | environment=LARAVEL_SAIL="1"
11 | stdout_logfile=/dev/stdout
12 | stdout_logfile_maxbytes=0
13 | stderr_logfile=/dev/stderr
14 | stderr_logfile_maxbytes=0
15 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | ./src/**/Tests/Unit
10 |
11 |
12 | ./src/**/Tests/Feature
13 |
14 |
15 |
16 |
17 | ./src
18 |
19 |
20 | ./src/**/Tests/*
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/pint.json:
--------------------------------------------------------------------------------
1 | {
2 | "preset": "laravel",
3 | "rules": {
4 | "no_binary_string": false,
5 | "strict_comparison": true,
6 | "ternary_to_null_coalescing": true
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Send Requests To Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class);
50 |
51 | $response = $kernel->handle(
52 | $request = Request::capture()
53 | )->send();
54 |
55 | $kernel->terminate($request, $response);
56 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'accepted_if' => 'The :attribute must be accepted when :other is :value.',
18 | 'active_url' => 'The :attribute is not a valid URL.',
19 | 'after' => 'The :attribute must be a date after :date.',
20 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
21 | 'alpha' => 'The :attribute must only contain letters.',
22 | 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
23 | 'alpha_num' => 'The :attribute must only contain letters and numbers.',
24 | 'array' => 'The :attribute must be an array.',
25 | 'before' => 'The :attribute must be a date before :date.',
26 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
27 | 'between' => [
28 | 'numeric' => 'The :attribute must be between :min and :max.',
29 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
30 | 'string' => 'The :attribute must be between :min and :max characters.',
31 | 'array' => 'The :attribute must have between :min and :max items.',
32 | ],
33 | 'boolean' => 'The :attribute field must be true or false.',
34 | 'confirmed' => 'The :attribute confirmation does not match.',
35 | 'current_password' => 'The password is incorrect.',
36 | 'date' => 'The :attribute is not a valid date.',
37 | 'date_equals' => 'The :attribute must be a date equal to :date.',
38 | 'date_format' => 'The :attribute does not match the format :format.',
39 | 'declined' => 'The :attribute must be declined.',
40 | 'declined_if' => 'The :attribute must be declined when :other is :value.',
41 | 'different' => 'The :attribute and :other must be different.',
42 | 'digits' => 'The :attribute must be :digits digits.',
43 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
44 | 'dimensions' => 'The :attribute has invalid image dimensions.',
45 | 'distinct' => 'The :attribute field has a duplicate value.',
46 | 'email' => 'The :attribute must be a valid email address.',
47 | 'ends_with' => 'The :attribute must end with one of the following: :values.',
48 | 'exists' => 'The selected :attribute is invalid.',
49 | 'file' => 'The :attribute must be a file.',
50 | 'filled' => 'The :attribute field must have a value.',
51 | 'gt' => [
52 | 'numeric' => 'The :attribute must be greater than :value.',
53 | 'file' => 'The :attribute must be greater than :value kilobytes.',
54 | 'string' => 'The :attribute must be greater than :value characters.',
55 | 'array' => 'The :attribute must have more than :value items.',
56 | ],
57 | 'gte' => [
58 | 'numeric' => 'The :attribute must be greater than or equal to :value.',
59 | 'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
60 | 'string' => 'The :attribute must be greater than or equal to :value characters.',
61 | 'array' => 'The :attribute must have :value items or more.',
62 | ],
63 | 'image' => 'The :attribute must be an image.',
64 | 'in' => 'The selected :attribute is invalid.',
65 | 'in_array' => 'The :attribute field does not exist in :other.',
66 | 'integer' => 'The :attribute must be an integer.',
67 | 'ip' => 'The :attribute must be a valid IP address.',
68 | 'ipv4' => 'The :attribute must be a valid IPv4 address.',
69 | 'ipv6' => 'The :attribute must be a valid IPv6 address.',
70 | 'json' => 'The :attribute must be a valid JSON string.',
71 | 'lt' => [
72 | 'numeric' => 'The :attribute must be less than :value.',
73 | 'file' => 'The :attribute must be less than :value kilobytes.',
74 | 'string' => 'The :attribute must be less than :value characters.',
75 | 'array' => 'The :attribute must have less than :value items.',
76 | ],
77 | 'lte' => [
78 | 'numeric' => 'The :attribute must be less than or equal to :value.',
79 | 'file' => 'The :attribute must be less than or equal to :value kilobytes.',
80 | 'string' => 'The :attribute must be less than or equal to :value characters.',
81 | 'array' => 'The :attribute must not have more than :value items.',
82 | ],
83 | 'max' => [
84 | 'numeric' => 'The :attribute must not be greater than :max.',
85 | 'file' => 'The :attribute must not be greater than :max kilobytes.',
86 | 'string' => 'The :attribute must not be greater than :max characters.',
87 | 'array' => 'The :attribute must not have more than :max items.',
88 | ],
89 | 'mimes' => 'The :attribute must be a file of type: :values.',
90 | 'mimetypes' => 'The :attribute must be a file of type: :values.',
91 | 'min' => [
92 | 'numeric' => 'The :attribute must be at least :min.',
93 | 'file' => 'The :attribute must be at least :min kilobytes.',
94 | 'string' => 'The :attribute must be at least :min characters.',
95 | 'array' => 'The :attribute must have at least :min items.',
96 | ],
97 | 'multiple_of' => 'The :attribute must be a multiple of :value.',
98 | 'not_in' => 'The selected :attribute is invalid.',
99 | 'not_regex' => 'The :attribute format is invalid.',
100 | 'numeric' => 'The :attribute must be a number.',
101 | 'password' => 'The password is incorrect.',
102 | 'present' => 'The :attribute field must be present.',
103 | 'regex' => 'The :attribute format is invalid.',
104 | 'required' => 'The :attribute field is required.',
105 | 'required_if' => 'The :attribute field is required when :other is :value.',
106 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
107 | 'required_with' => 'The :attribute field is required when :values is present.',
108 | 'required_with_all' => 'The :attribute field is required when :values are present.',
109 | 'required_without' => 'The :attribute field is required when :values is not present.',
110 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
111 | 'prohibited' => 'The :attribute field is prohibited.',
112 | 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
113 | 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
114 | 'prohibits' => 'The :attribute field prohibits :other from being present.',
115 | 'same' => 'The :attribute and :other must match.',
116 | 'size' => [
117 | 'numeric' => 'The :attribute must be :size.',
118 | 'file' => 'The :attribute must be :size kilobytes.',
119 | 'string' => 'The :attribute must be :size characters.',
120 | 'array' => 'The :attribute must contain :size items.',
121 | ],
122 | 'starts_with' => 'The :attribute must start with one of the following: :values.',
123 | 'string' => 'The :attribute must be a string.',
124 | 'timezone' => 'The :attribute must be a valid timezone.',
125 | 'unique' => 'The :attribute has already been taken.',
126 | 'uploaded' => 'The :attribute failed to upload.',
127 | 'url' => 'The :attribute must be a valid URL.',
128 | 'uuid' => 'The :attribute must be a valid UUID.',
129 |
130 | /*
131 | |--------------------------------------------------------------------------
132 | | Custom Validation Language Lines
133 | |--------------------------------------------------------------------------
134 | |
135 | | Here you may specify custom validation messages for attributes using the
136 | | convention "attribute.rule" to name the lines. This makes it quick to
137 | | specify a specific custom language line for a given attribute rule.
138 | |
139 | */
140 |
141 | 'custom' => [
142 | 'attribute-name' => [
143 | 'rule-name' => 'custom-message',
144 | ],
145 | ],
146 |
147 | /*
148 | |--------------------------------------------------------------------------
149 | | Custom Validation Attributes
150 | |--------------------------------------------------------------------------
151 | |
152 | | The following language lines are used to swap our attribute placeholder
153 | | with something more reader friendly such as "E-Mail Address" instead
154 | | of "email". This simply helps us make our message more expressive.
155 | |
156 | */
157 |
158 | 'attributes' => [],
159 |
160 | ];
161 |
--------------------------------------------------------------------------------
/routes/api.php:
--------------------------------------------------------------------------------
1 | null);
18 |
19 | // Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
20 | // return $request->user();
21 | // });
22 |
--------------------------------------------------------------------------------
/routes/channels.php:
--------------------------------------------------------------------------------
1 | id === (int) $id;
18 | });
19 |
--------------------------------------------------------------------------------
/routes/console.php:
--------------------------------------------------------------------------------
1 | comment(Inspiring::quote());
19 | })->purpose('Display an inspiring quote');
20 |
--------------------------------------------------------------------------------
/server.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $uri = urldecode(
9 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
10 | );
11 |
12 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
13 | // built-in PHP web server. This provides a convenient way to test a Laravel
14 | // application without having installed a "real" web server software here.
15 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
16 | return false;
17 | }
18 |
19 | require_once __DIR__.'/public/index.php';
20 |
--------------------------------------------------------------------------------
/src/Inventory/Application/Http/Controllers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Inventory/Application/Http/Controllers/.gitkeep
--------------------------------------------------------------------------------
/src/Inventory/Application/Http/Controllers/ProductController.php:
--------------------------------------------------------------------------------
1 | id = $id;
24 | $this->name = $name;
25 | $this->price = $price;
26 | }
27 |
28 | public function getId(): int
29 | {
30 | return $this->id;
31 | }
32 |
33 | public function getName(): string
34 | {
35 | return $this->name;
36 | }
37 |
38 | public function getPrice(): int
39 | {
40 | return $this->price;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Inventory/Contracts/Exceptions/InactiveProductException.php:
--------------------------------------------------------------------------------
1 | 'boolean',
22 | ];
23 |
24 | /**
25 | * Create a new factory instance for the model.
26 | *
27 | * @return \Illuminate\Database\Eloquent\Factories\Factory
28 | */
29 | protected static function newFactory()
30 | {
31 | return ProductFactory::new();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Inventory/Domain/Rules/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Inventory/Domain/Rules/.gitkeep
--------------------------------------------------------------------------------
/src/Inventory/Domain/Services/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Inventory/Domain/Services/.gitkeep
--------------------------------------------------------------------------------
/src/Inventory/Infrastructure/Database/Factories/ProductFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->name,
28 | 'description' => $this->faker->text,
29 | 'price' => $this->faker->randomNumber(2),
30 | 'stock' => $this->faker->randomNumber(3),
31 | 'is_active' => $this->faker->boolean,
32 | ];
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Inventory/Infrastructure/Database/Migrations/2021_11_23_234141_create_products_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('name');
19 | $table->string('description');
20 | $table->unsignedInteger('price');
21 | $table->integer('stock');
22 | $table->boolean('is_active')->default(true);
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('products');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Inventory/Infrastructure/Database/Seeders/ProductSeeder.php:
--------------------------------------------------------------------------------
1 | create();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Inventory/Infrastructure/Repositories/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Inventory/Infrastructure/Repositories/.gitkeep
--------------------------------------------------------------------------------
/src/Inventory/Infrastructure/Services/ProductService.php:
--------------------------------------------------------------------------------
1 | stock < $quantity) {
36 | throw new OutOfStockException($productId);
37 | }
38 |
39 | if (! $product->is_active) {
40 | throw new InactiveProductException($productId);
41 | }
42 |
43 | $product->decrement('stock', $quantity);
44 | }
45 |
46 | /**
47 | * Get product by product id.
48 | *
49 | * @param int $id
50 | * @return \Laracon\Inventory\Contracts\DataTransferObjects\ProductDto
51 | *
52 | * @throws \Laracon\Inventory\Contracts\Exceptions\ProductNotFoundException
53 | */
54 | public function getProductById(int $productId): ProductDto
55 | {
56 | $product = Product::find($productId);
57 |
58 | if (! $product) {
59 | throw new ProductNotFoundException($productId);
60 | }
61 |
62 | return new ProductDto(
63 | $product->id,
64 | $product->name,
65 | $product->price,
66 | );
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Inventory/Providers/InventoryServiceProvider.php:
--------------------------------------------------------------------------------
1 | ProductService::class,
20 | ];
21 |
22 | /**
23 | * Define your route model bindings, pattern filters, etc.
24 | *
25 | * @return void
26 | */
27 | public function boot()
28 | {
29 | $this->loadRoutesFrom(__DIR__.'/../routes.php');
30 |
31 | $this->loadMigrationsFrom(__DIR__.'/../Infrastructure/Database/Migrations');
32 |
33 | // $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'inventory');
34 | }
35 |
36 | /**
37 | * Register any application services.
38 | *
39 | * @return void
40 | */
41 | public function register()
42 | {
43 | // manually register bindings
44 | // $this->app->bind(ProductServiceContract::class, ProductService::class);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Inventory/Tests/Feature/Controllers/ProductControllerTest.php:
--------------------------------------------------------------------------------
1 | create();
13 |
14 | Sanctum::actingAs(User::factory()->create());
15 |
16 | getJson('/inventory-module/products?page=2')
17 | ->assertOk()
18 | ->assertJson(fn (AssertableJson $json) => $json->has('data', 10)
19 | ->has('links')
20 | ->has('meta')
21 | ->where('meta.per_page', 10)
22 | ->where('meta.current_page', 2)
23 | ->where('meta.last_page', 3)
24 | ->where('meta.from', 11)
25 | ->where('meta.to', 20)
26 | ->where('meta.total', 30)
27 | );
28 | });
29 |
--------------------------------------------------------------------------------
/src/Inventory/Tests/Unit/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Inventory/Tests/Unit/.gitkeep
--------------------------------------------------------------------------------
/src/Inventory/routes.php:
--------------------------------------------------------------------------------
1 | middleware(['api', 'auth:sanctum'])
7 | ->namespace('Laracon\Inventory\Application\Http\Controllers')
8 | ->group(function () {
9 | Route::apiResource('products', ProductController::class);
10 | });
11 |
--------------------------------------------------------------------------------
/src/Order/Application/Http/Controllers/OrderController.php:
--------------------------------------------------------------------------------
1 | findOrFail($request->cart_id);
43 | $order = new Order(['user_id' => $request->user()->id]);
44 |
45 | try {
46 | DB::transaction(function () use ($order, $cart) {
47 | $cart->cartItems->each(function (CartItem $cartItem) use ($order) {
48 | $this->productService->decrementStock($cartItem->product_id, $cartItem->quantity);
49 | $product = $this->productService->getProductById($cartItem->product_id);
50 | $order->addOrderLine($product, $cartItem->quantity);
51 | });
52 |
53 | $order->checkout();
54 |
55 | $this->paymentService->charge($order->id, $order->total_amount);
56 | });
57 | } catch (\Exception $e) {
58 | abort(Response::HTTP_BAD_REQUEST, trans('order::errors.failed'));
59 | }
60 |
61 | OrderFulfilled::dispatch($order->id);
62 |
63 | return new OrderResource($order);
64 | }
65 |
66 | /**
67 | * Display the specified resource.
68 | *
69 | * @param \Laracon\Order\Domain\Models\Order $order
70 | * @return \Illuminate\Http\Response
71 | */
72 | public function show(Order $order)
73 | {
74 | $this->authorize('view', $order);
75 |
76 | return new OrderResource($order);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/Order/Application/Http/Middleware/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Application/Http/Middleware/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Application/Http/Requests/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Application/Http/Requests/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Application/Http/Requests/StoreOrderRequest.php:
--------------------------------------------------------------------------------
1 | ['required', 'integer', 'exists:carts,id'],
28 | ];
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Order/Application/Http/Resources/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Application/Http/Resources/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Application/Http/Resources/Order.php:
--------------------------------------------------------------------------------
1 | id === $order->user_id;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Order/Contracts/Events/OrderFulfilled.php:
--------------------------------------------------------------------------------
1 | hasMany(CartItem::class);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Order/Domain/Models/CartItem.php:
--------------------------------------------------------------------------------
1 | belongsTo(Cart::class);
41 | }
42 |
43 | public function product(): BelongsTo
44 | {
45 | return $this->belongsTo(Product::class);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Order/Domain/Models/Enums/OrderStatus.php:
--------------------------------------------------------------------------------
1 | hasMany(OrderLine::class);
42 | }
43 |
44 | public function addOrderLine(ProductDto $product, int $quantity): void
45 | {
46 | $orderLine = new OrderLine([
47 | 'product_id' => $product->id,
48 | 'product_name' => $product->name,
49 | 'price' => $product->price,
50 | 'quantity' => $quantity,
51 | ]);
52 |
53 | $this->orderLines[] = $orderLine;
54 | }
55 |
56 | public function checkout(): void
57 | {
58 | if (empty($this->orderLines)) {
59 | throw new EmptyOrderException();
60 | }
61 |
62 | $this->amount = collect($this->orderLines)->sum(fn (OrderLine $orderLine) => $orderLine->subtotal()
63 | );
64 | $this->tax = $this->amount * TaxRate::current()->rate;
65 | $this->total_amount = $this->amount + $this->tax;
66 |
67 | $this->save();
68 | $this->orderLines()->saveMany($this->orderLines);
69 | $this->refresh();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/Order/Domain/Models/OrderHistory.php:
--------------------------------------------------------------------------------
1 | belongsTo(Order::class);
14 | }
15 |
16 | public function status()
17 | {
18 | return $this->belongsTo(OrderStatus::class);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Order/Domain/Models/OrderLine.php:
--------------------------------------------------------------------------------
1 | belongsTo(Order::class);
27 | }
28 |
29 | public function subtotal(): int
30 | {
31 | return $this->price * $this->quantity;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Order/Domain/Models/OrderStatus.php:
--------------------------------------------------------------------------------
1 | OrderStatusEnum::class,
19 | ];
20 | }
21 |
--------------------------------------------------------------------------------
/src/Order/Domain/Models/TaxRate.php:
--------------------------------------------------------------------------------
1 | 'datetime',
23 | 'end_at' => 'datetime',
24 | ];
25 |
26 | /**
27 | * Create a new factory instance for the model.
28 | *
29 | * @return \Illuminate\Database\Eloquent\Factories\Factory
30 | */
31 | protected static function newFactory()
32 | {
33 | return TaxRateFactory::new();
34 | }
35 |
36 | /**
37 | * Get the current tax rate.
38 | *
39 | * @return self
40 | *
41 | * @throws \Laracon\Order\Domain\Exceptions\TaxRateNotFoundException
42 | */
43 | public static function current(): self
44 | {
45 | $now = now();
46 |
47 | $rate = self::where('start_at', '<=', $now)
48 | ->where('end_at', '>=', $now)
49 | ->first();
50 |
51 | if (! $rate) {
52 | throw new TaxRateNotFoundException();
53 | }
54 |
55 | return $rate;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Order/Domain/Rules/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Domain/Rules/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Domain/Services/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Domain/Services/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Factories/CartFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->randomNumber(),
28 | ];
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Factories/CartItemFactory.php:
--------------------------------------------------------------------------------
1 | Cart::factory(),
29 | 'product_id' => $this->faker->randomNumber(),
30 | 'quantity' => $this->faker->randomNumber(),
31 | ];
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Factories/OrderFactory.php:
--------------------------------------------------------------------------------
1 | 0.08,
28 | 'start_at' => now()->subYears(3),
29 | 'end_at' => now()->addYears(2),
30 | ];
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2021_11_24_093653_create_orders_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('user_id')->index();
19 | $table->unsignedInteger('amount');
20 | $table->unsignedInteger('tax');
21 | $table->unsignedInteger('total_amount');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('orders');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_071834_create_carts_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('user_id')->index();
19 | $table->dateTime('checked_out_at')->nullable();
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('carts');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_072128_create_cart_items_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('cart_id')->constrained('carts');
19 | $table->foreignId('product_id');
20 | $table->unsignedInteger('quantity');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::dropIfExists('cart_items');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_072812_create_order_lines_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('order_id')->constrained();
19 | $table->foreignId('product_id');
20 | $table->string('product_name');
21 | $table->unsignedInteger('price');
22 | $table->unsignedInteger('quantity');
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('order_lines');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_073028_create_order_statuses_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('name');
19 | $table->string('slug')->unique();
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('order_statuses');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_073258_create_order_histories_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('order_id')->constrained();
19 | $table->foreignId('status_id')->constrained('order_statuses');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('order_histories');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_073648_create_tax_rates_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->decimal('rate');
19 | $table->dateTime('start_at');
20 | $table->dateTime('end_at');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::dropIfExists('tax_rates');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_16_090113_add_shipping_address_id_to_orders_table.php:
--------------------------------------------------------------------------------
1 | foreignId('shipping_address_id')->after('user_id');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('orders', function (Blueprint $table) {
29 | $table->dropColumn('shipping_address_id');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Migrations/2022_01_20_133710_remove_shipping_address_id_from_orders_table.php:
--------------------------------------------------------------------------------
1 | dropColumn('shipping_address_id');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('orders', function (Blueprint $table) {
29 | $table->foreignId('shipping_address_id')->after('user_id');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Database/Seeders/OrderSeeder.php:
--------------------------------------------------------------------------------
1 | create();
21 |
22 | Order::factory(10)->for($user)->create();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Repositories/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Infrastructure/Repositories/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Infrastructure/Services/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Infrastructure/Services/.gitkeep
--------------------------------------------------------------------------------
/src/Order/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 | OrderPolicy::class,
20 | ];
21 |
22 | /**
23 | * Register any authentication / authorization services.
24 | *
25 | * @return void
26 | */
27 | public function boot()
28 | {
29 | $this->registerPolicies();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Order/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
20 | HandleOrderShipment::class,
21 | ],
22 | ];
23 |
24 | /**
25 | * Register any events for your application.
26 | *
27 | * @return void
28 | */
29 | public function boot()
30 | {
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Order/Providers/OrderServiceProvider.php:
--------------------------------------------------------------------------------
1 | loadRoutesFrom(__DIR__.'/../routes.php');
19 |
20 | $this->loadMigrationsFrom(__DIR__.'/../Infrastructure/Database/Migrations');
21 |
22 | $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'order');
23 |
24 | // $this->loadViewsFrom(__DIR__.'/../Resources/views', 'order');
25 |
26 | // $this->loadViewComponentsAs('order', [
27 | // Alert::class,
28 | // Button::class,
29 | // ]);
30 | }
31 |
32 | /**
33 | * Register any application services.
34 | *
35 | * @return void
36 | */
37 | public function register()
38 | {
39 | $this->app->register(AuthServiceProvider::class);
40 | $this->app->register(EventServiceProvider::class);
41 | $this->app->register(RouteServiceProvider::class);
42 |
43 | // $this->mergeConfigFrom(__DIR__.'/../config/order.php', 'order');
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Order/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | findOrFail($value);
22 | });
23 |
24 | // $this->app['router']->aliasMiddleware('do-something', \Laracon\Order\Application\Http\Middleware\SomeMiddleware::class);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Order/Resources/lang/en/errors.php:
--------------------------------------------------------------------------------
1 | 'An error occurred while processing your order.',
17 |
18 | ];
19 |
--------------------------------------------------------------------------------
/src/Order/Tests/Feature/Controllers/OrderControllerTest.php:
--------------------------------------------------------------------------------
1 | create();
23 | $user = User::factory()->create();
24 | $cart = Cart::factory()->create([
25 | 'user_id' => $user->id,
26 | ]);
27 |
28 | $products = collect([
29 | new ProductDto(1, 'Product 1', 100),
30 | new ProductDto(2, 'Product 2', 200),
31 | ]);
32 |
33 | $cart->cartItems()->createMany(
34 | $products->map(fn (ProductDto $product) => [
35 | 'product_id' => $product->id,
36 | 'quantity' => 1,
37 | ])
38 | );
39 |
40 | mock(ProductService::class, function ($mock) use ($products) {
41 | $products->each(function (ProductDto $product) use ($mock) {
42 | $mock->shouldReceive('decrementStock')
43 | ->with($product->id, 1)
44 | ->once();
45 |
46 | $mock->shouldReceive('getProductById')
47 | ->with($product->id)
48 | ->once()
49 | ->andReturn($product);
50 | });
51 | });
52 |
53 | mock(PaymentService::class)
54 | ->shouldReceive('charge')
55 | ->once();
56 |
57 | Sanctum::actingAs($user);
58 |
59 | $order = postJson('/order-module/orders', ['cart_id' => $cart->id])
60 | ->assertCreated()
61 | ->json('data');
62 |
63 | assertDatabaseHas('orders', [
64 | 'id' => $order['id'],
65 | ]);
66 | assertDatabaseCount('order_lines', 2);
67 | Event::assertDispatched(OrderFulfilled::class, $order['id']);
68 | });
69 |
--------------------------------------------------------------------------------
/src/Order/Tests/Unit/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Order/Tests/Unit/.gitkeep
--------------------------------------------------------------------------------
/src/Order/routes.php:
--------------------------------------------------------------------------------
1 | middleware(['api', 'auth:sanctum'])
7 | ->namespace('Laracon\Order\Application\Http\Controllers')
8 | ->group(function () {
9 | Route::apiResource('orders', OrderController::class);
10 | });
11 |
--------------------------------------------------------------------------------
/src/Payment/Application/Http/Controllers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Application/Http/Controllers/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Application/Http/Middleware/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Application/Http/Middleware/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Application/Http/Requests/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Application/Http/Requests/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Application/Http/Resources/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Application/Http/Resources/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Application/Policies/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Application/Policies/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Contracts/Exceptions/PaymentException.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('user_id')->index();
19 | $table->string('country');
20 | $table->string('postal_code');
21 | $table->string('city');
22 | $table->string('address_line_one');
23 | $table->string('address_line_two')->nullable();
24 | $table->timestamps();
25 | });
26 | }
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::dropIfExists('billing_addresses');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Payment/Infrastructure/Repositories/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Infrastructure/Repositories/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Infrastructure/Services/PaddlePaymentService.php:
--------------------------------------------------------------------------------
1 | StripePaymentService::class,
20 | ];
21 |
22 | /**
23 | * Define your route model bindings, pattern filters, etc.
24 | *
25 | * @return void
26 | */
27 | public function boot()
28 | {
29 | // $this->loadRoutesFrom(__DIR__.'/../routes.php');
30 |
31 | // $this->loadMigrationsFrom(__DIR__.'/../Infrastructure/Database/Migrations');
32 |
33 | // $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'payment');
34 | }
35 |
36 | /**
37 | * Register any application services.
38 | *
39 | * @return void
40 | */
41 | public function register()
42 | {
43 | //
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Payment/Tests/Feature/Controllers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Tests/Feature/Controllers/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/Tests/Unit/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/Tests/Unit/.gitkeep
--------------------------------------------------------------------------------
/src/Payment/routes.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Payment/routes.php
--------------------------------------------------------------------------------
/src/Shipping/Application/Http/Controllers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Application/Http/Controllers/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Application/Http/Middleware/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Application/Http/Middleware/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Application/Http/Requests/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Application/Http/Requests/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Application/Http/Resources/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Application/Http/Resources/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Application/Policies/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Application/Policies/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Contracts/Events/ParcelShipped.php:
--------------------------------------------------------------------------------
1 | orderId);
31 |
32 | // notify warehouse system
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Shipping/Domain/Models/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Domain/Models/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Domain/Models/ShippingAddress.php:
--------------------------------------------------------------------------------
1 | $this->faker->randomNumber(),
28 | 'country' => $this->faker->country(),
29 | 'postal_code' => $this->faker->postcode(),
30 | 'city' => $this->faker->city(),
31 | 'address_line_one' => $this->faker->streetAddress(),
32 | 'address_line_one' => $this->faker->buildingNumber(),
33 | ];
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Shipping/Infrastructure/Database/Migrations/2022_01_16_084411_create_shipping_addresses_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->foreignId('user_id')->index();
19 | $table->string('country');
20 | $table->string('postal_code');
21 | $table->string('city');
22 | $table->string('address_line_one');
23 | $table->string('address_line_two')->nullable();
24 | $table->timestamps();
25 | });
26 | }
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::dropIfExists('shipping_addresses');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Shipping/Infrastructure/Repositories/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Infrastructure/Repositories/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Infrastructure/Services/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Infrastructure/Services/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
20 | NotifyWarehouse::class,
21 | ],
22 | ];
23 |
24 | /**
25 | * Register any events for your application.
26 | *
27 | * @return void
28 | */
29 | public function boot()
30 | {
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Shipping/Providers/ShippingServiceProvider.php:
--------------------------------------------------------------------------------
1 | loadRoutesFrom(__DIR__.'/../routes.php');
28 |
29 | $this->loadMigrationsFrom(__DIR__.'/../Infrastructure/Database/Migrations');
30 |
31 | // $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'shipping');
32 | }
33 |
34 | /**
35 | * Register any application services.
36 | *
37 | * @return void
38 | */
39 | public function register()
40 | {
41 | $this->app->register(EventServiceProvider::class);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Shipping/Tests/Feature/Controllers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Tests/Feature/Controllers/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/Tests/Unit/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/Tests/Unit/.gitkeep
--------------------------------------------------------------------------------
/src/Shipping/routes.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/avosalmon/modular-monolith-laravel/10fa9e08c58468e5b0edb38a44b175cb542e5e46/src/Shipping/routes.php
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | compiled.php
2 | config.php
3 | down
4 | events.scanned.php
5 | maintenance.php
6 | routes.php
7 | routes.scanned.php
8 | schedule-*
9 | services.json
10 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !data/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/framework/cache/data/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/testing/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
19 |
20 | return $app;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/Pest.php:
--------------------------------------------------------------------------------
1 | in('Feature');
15 |
16 | /*
17 | |--------------------------------------------------------------------------
18 | | Expectations
19 | |--------------------------------------------------------------------------
20 | |
21 | | When you're writing tests, you often need to check that values meet certain conditions. The
22 | | "expect()" function gives you access to a set of "expectations" methods that you can use
23 | | to assert different things. Of course, you may extend the Expectation API at any time.
24 | |
25 | */
26 |
27 | /*
28 | |--------------------------------------------------------------------------
29 | | Functions
30 | |--------------------------------------------------------------------------
31 | |
32 | | While Pest is very powerful out-of-the-box, you may have some testing code specific to your
33 | | project that you don't want to repeat in every file. Here you can also expose helpers as
34 | | global functions to help you to reduce the number of lines of code in your test files.
35 | |
36 | */
37 |
38 | // function something()
39 | // {
40 | // // ..
41 | // }
42 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 |