Modulator

Modulator

Laravel Modulator (HMVC) creating and handling in an easy and simple way.

Moamen Eltouny (Raggi)
PHP Version : >= 7.4 Laravel Version : >= 8.0 License Support
Source Packagist Version Packagist Downloads

Install

Install the latest version using Composer

composer require pharaonic/laravel-modulator
Make

Create a new module.

creating in ./app/Modules/[module-name]

php artisan module:make [module-name]

Create a new custom Eloquent cast class of a module.

php artisan module:make:cast [module-name] [cast-name]

Create a new channel class of a module.

php artisan module:make:channel [module-name] [channel-name]

Create a new Artisan command of a module.

php artisan module:make:command [module-name] [command-name]
--test Generate an accompanying PHPUnit test for the Command.
--pest Generate an accompanying Pest test for the Command.
--command The terminal command that should be assigned [default: "command:name"].

Create a new view component of a module.

php artisan module:make:component [module-name] [component-name]
--force Create the class even if the component already exists.
--inline Create a component that renders an inline view.

Create a new controller class of a module.

php artisan module:make:controller [module-name] [controller-name]
-m, --model[=MODEL] The model class that related to the controller.
--force Create the class even if the controller already exists.
--test Generate an accompanying PHPUnit test for the Controller.
--pest Generate an accompanying Pest test for the Controller.

Create a new event class of a module.

php artisan module:make:event [module-name] [event-name]

Create a new custom exception class of a module.

php artisan module:make:exception [module-name] [exception-name]
--render Create the exception with an empty render method.
--report Create the exception with an empty report method.

Create a new model factory of a module.

php artisan module:make:factory [module-name] [factory-name]

Create a new job class of a module.

php artisan module:make:job [module-name] [job-name]
--sync Indicates that job should be synchronous.
--test Generate an accompanying PHPUnit test for the Job.
--pest Generate an accompanying Pest test for the Job.

Create a new event listener class of a module.

php artisan module:make:listener [module-name] [listener-name]
-e, --event[=EVENT] The event class being listened for.
--queued Indicates the event listener should be queued.
--test Generate an accompanying PHPUnit test for the Listener.
--pest Generate an accompanying Pest test for the Listener.

Create a new email class of a module.

php artisan module:make:mail [module-name] [mail-name]
-f, --force Create the class even if the mailable already exists.
-m, --markdown[=MARKDOWN] Create a new Markdown template for the mailable [default: false].
--test Generate an accompanying PHPUnit test for the Mail.
--pest Generate an accompanying Pest test for the Mail.

Create a new middleware class of a module.

php artisan module:make:middleware [module-name] [middleware-name]
--test Generate an accompanying PHPUnit test for the Middleware.
--pest Generate an accompanying Pest test for the Middleware.

Create a new migration file of a module.

php artisan module:make:migration [module-name] [migration-name]
--create[=CREATE] The table to be created.
--table[=TABLE] The table to migrate.

Create a new Eloquent model class of a module.

php artisan module:make:model [module-name] [model-name]
-a, --all Create a new migration, fatcory, seeder and policy files for the model.
-m, --migration Create a new migration file for the model.
-f, --factory Create a new factory for the model.
-s, --seed Create a new seeder for the model.
-p, --policy Create a new policy for the model.
--force Create the class even if the model already exists.
--test Generate an accompanying PHPUnit test for the Model.
--pest Generate an accompanying Pest test for the Model.

Create a new notification class of a module.

php artisan module:make:notification [module-name] [notification-name]
--test Generate an accompanying PHPUnit test for the Notification.
--pest Generate an accompanying Pest test for the Notification.
-f, --force Create the class even if the notification already exists.
-m, --markdown[=MARKDOWN] Create a new Markdown template for the notification.

Create a new observer class of a module.

php artisan module:make:observer [module-name] [observer-name]
--model[=MODEL] The model that the observer applies to.

Create a new policy class of a module.

php artisan module:make:policy [module-name] [policy-name]
--guard[=GUARD] The guard that the policy relies on.
--model[=MODEL] The model that the policy applies to.

Create a new service provider class of a module.

php artisan module:make:provider [module-name] [provider-name]

Create a new form request class of a module.

php artisan module:make:request [module-name] [request-name]
-j, --json Create a new jsonable form request.

Create a new resource of a module.

php artisan module:make:resource [module-name] [resource-name]
-j, --json Create a new jsonable resource.
-c, --collection Create a resource collection.

Create a new validation rule of a module.

php artisan module:make:rule [module-name] [rule-name]

Create a new seeder class of a module.

php artisan module:make:seeder [module-name] [seeder-name]

Create a new test class of a module.

php artisan module:make:test [module-name] [test-name]
-u, --unit/td> Create a unit test.
-p, --pest Create a Pest test.

Run the database migrations of a module.

php artisan module:migrate [module-name]

Drop all tables then re-run migrations of a module.

php artisan module:migrate:fresh [module-name]
--drop-views Drop all tables and views.
--drop-types Drop all tables and types (Postgres only).
--force Force the operation to run when in production.
--seed Indicates if the seed task should be re-run.
--seeder[=SEEDER] The class name of the root seeder.
--schema-path[=SCHEMA-PATH] The path to a schema dump file.
--step[=STEP] Force the migrations to be run so they can be rolled back individually.

Reset and re-run all module migrations.

php artisan module:migrate:refresh [module-name]
--force Force the operation to run when in production.
--seed Indicates if the seed task should be re-run.
--seeder[=SEEDER] The class name of the root seeder.
--step[=STEP] The number of migrations to be reverted & re-run.

Rollback all database migrations of a module.

php artisan module:migrate:reset [module-name]
--force Force the operation to run when in production.

Rollback the last database migration of a module.

php artisan module:migrate:rollback [module-name]
--force Force the operation to run when in production.
--step[=STEP] The number of migrations to be reverted.

Show the status of each migration of a module.

php artisan module:migrate:status [module-name]
Actions

Display all modules info.

php artisan module:list

Get routes list of a specific module.

php artisan module:routes [module-name]
-c, --compact Only show method, URI and action columns.
-r, --reverse Reverse the ordering of the routes.
--json Output the route list as JSON
--columns[=COLUMNS] Columns to include in the route table (multiple values allowed)
--method[=METHOD] Filter the routes by method
--sort[=SORT] The column (precedence, domain, method, uri, name, action, middleware) to sort by [default: "uri"]

Seed the database with records of a module.

php artisan module:seed [module-name]
--force Force the operation to run when in production.
--class[=CLASS] The class name of the root seeder [default: "DatabaseSeeder"].

Run the module tests.

php artisan module:test [module-name]
-l, --list Get tests list.
-s, --stop-on-failure Stop all tests on the failure status.
-f, --filter[=FILTER] Test name (example: UserTest).
Packages

Using Translatable Package.

php artisan module:make:translatable [module-name] [model-name]
-m, --migration Create a new migration file for the model and translatable-model.