A simple package to set up domains for your applications.
To install through composer, run the following command from terminal:
composer require supplycart/domainsThen publish config using:
php artisan vendor:publishYou can set up a domain by creating a domain class which extends Supplycart\Domains\Domain and register it inside domains.php config file like this:
<?php
return [
'modules' => [
App\Domains\User\UserDomain::class
]
];The folder structure suggested is as below:
app/
- Domains/
- User/
- database/
- migrations/
- Events/
- Http/
- Controllers/
- routes.php # all routes in here
- Jobs/
- Listeners/
- Models/
- Policies/
- UserDomain.php # your domain class
- Cart
...
- Order
...
Command to populate domain folder
php artisan make:domain DomainNameTo populate events, listeners and jobs you may pass in the --queues argument.
php artisan make:domain DomainName --queuesTo create migrations for your domain, run the following command from terminal:
php artisan domain:make-migration DomainName MigrationNameTo create controllers for your domain, run the following command from terminal:
php artisan domain:make-controller DomainName ControllerNameTo make an invokable controller you may pass in --invokable argument.
php artisan domain:make-controller DomainName ControllerName --invokable