composer require jair921/laravel-domain-commands
You can publish config, if you want
php artisan vendor:publish --tag="domain-commands-config"
-
make:model <domain:model>
Create a new Eloquent model class
Example:
php artisan make:model User:User
Options:
--force
Create the class even if the model already exists-a, --all
Generate a migration, seeder & factory for the model-f, --factory
Create a new factory for the model-m, --migration
Create a new migration file for the model-s, --seed
Create a new seeder file for the model-p, --pivot
Indicates if the generated model should be a custom intermediate table model
-
make:action <domain:action>
Create an action for a given domain
Example:
php artisan make:action User:CreateUserAction
-
make:dto <domain:dto>
Create a dto for a given domain
Example:
php artisan make:dto User:CreateUserDTO
You should install https://github.com/spatie/data-transfer-object for convenience
Options:
-r, --request
DTO file with static fromRequest method
-
make:cast <domain:cast>
Create a new custom Eloquent cast class
Example:
php artisan make:cast User:JsonCast
-
make:collection <domain:collection>
Create a collection for a given domain
Example:
php artisan make:collection User:UserCollection
-
make:event <domain:event>
Create a new event class
Example:
php artisan make:event User:UserCreatedEvent
-
make:enum <domain:enum>
Create an enum for a given domain
Example:
php artisan make:enum User:UserColorEnum
-
make:listener <domain:listener>
Create a new event listener class
Example:
php artisan make:listener User:SendSlackMessage -e User:UserCreatedEvent --queued
Options:
--queued
Indicates the event listener should be queued-e, --event=<domain:event>
The event class being listened for
-
make:observer <domain:observer>
Create a new observer class
Example:
php artisan make:observer User:UserObserver -m User:User
Options:
-m, --model=<domain:model>
The model that the observer applies to
-
make:policy <domain:policy>
Create a new policy class
Example:
php artisan make:policy User:UserPolicy -m User:Post
Options:
-m, --model=<domain:model>
The model that the policy applies to-g, --guard=<domain:model>
The guard that the policy relies on
-
make:query-builder <domain:query-builder>
Create a query builder for a given domain
Example:
php artisan make:query-builder User:UserQueryBuilder
-
make:rule <domain:rule>
Create a new validation rule
Example:
php artisan make:rule User:PasswordMinlengthRule
Options:
-i, --implicit
Generate an implicit rule
-
make:controller <domain:controller>
Create a new controller class
Example:
php artisan make:controller User:UserController
Options:
--force
Create the class even if the controller already exists--api
Exclude the create and edit methods from the controller-i, --invokable
Generate a single method, invokable controller class-m <domain:model>, --model=<domain:model>
Generate a resource controller for the given model-p <domain:model>, --parent=<domain:model>
Generate a nested resource controller class-r, --resource
Generate a resource controller class
-
make:request <domain:request>
Create a new form request class
Example:
php artisan make:request User:LoginRequest
-
make:job <domain:job>
Create a new job class
Example:
php artisan make:job User:SendMessageJob
Options:
--sync
Indicates that job should be synchronous
-
make:mail <domain:mail>
Create a new email class
Example:
php artisan make:mail User:WelcomeUser
Options:
-f, --force
Create the class even if the mailable already exists-m, --markdown[=MARKDOWN]
Create a new Markdown template for the mailable
-
make:notification <domain:notification>
Create a new notification class
Example:
php artisan make:notification User:InvoicePaid
Options:
-f, --force
Create the class even if the notification already exists-m, --markdown[=MARKDOWN]
Create a new Markdown template for the notification
-
make:middleware <domain:middleware>
Create a new middleware class
Example:
php artisan make:middleware User:AuthMiddleware
-
make:resource <domain:resource>
Create a new resource class
Example:
php artisan make:resource User:UserResource
Options:
-c, --collection
Create a resource collection
-
make:component <domain:component>
Create a new view component class
Example:
php artisan make:component User:UserComponent
Options:
--force
Create the class even if the component already exists--inline
Create a component that renders an inline view
-
make:view-model <domain:view-model>
Create a view-model for a given app
Example:
php artisan make:view-model User:UsersViewModel
-
make:factory <domain:factory>
Create a new model factory
Example:
php artisan make:factory UserFactory
Options:
-m <domain:model>, --model=<domain:model>
Bind factory to the model
- ADD TESTS
make:model --auth
?make:state [domain:name]
https://stitcher.io/blog/laravel-beyond-crud-05-statesmake:{http query builder} [app:name]