### Specific Module Configuration Example Source: https://l5modular.github.io/configuration Provides an example of how to define specific configurations for individual modules, overriding default settings. This includes enabling/disabling modules, routing options, and custom structures. ```php 'specific' => [ /* |-------------------------------------------------------------------------- | Example Module |-------------------------------------------------------------------------- | | This type of configuration would you allow | to use modules from L5Modular v1 | | 'ExampleModule' => [ | 'enabled' => false, | 'routing' => [ 'simple' ], | 'structure' => [ | 'controllers' => 'Controllers', | 'views' => 'Views', | 'translations' => 'Translations', | ], | ], */ ], ``` -------------------------------- ### Custom Module Structure Example Source: https://l5modular.github.io/getting-started This illustrates a more extensive module structure that can be generated with custom configurations. It includes additional directories for events, jobs, mail, notifications, and more, adhering to PSR-4 autoloading. ```text laravel-project/ app/ └── Modules/ └── HelloWorld ├── Events │   └── HelloWorld.php ├── Http │   ├── Controllers │   │   └── HelloWorldController.php │   ├── Requests │   │   └── HelloWorld.php │   └── Resources │   └── HelloWorld.php ├── Jobs │   └── HelloWorld.php ├── Listeners │   └── HelloWorld.php ├── Mail │   └── HelloWorld.php ├── Models │   └── HelloWorld.php ├── Notifications │   └── HelloWorld.php ├── Observers │   └── HelloWorld.php ├── Rules │   └── HelloWorld.php ├── config.php ├── database │   ├── factories │   │   └── HelloWorldFactory.php │   ├── migrations │   │   └── 2020_04_19_111656_create_foo_bars_table.php │   └── seeds │   └── HelloWorldSeeder.php ├── helpers.php ├── resources │   ├── lang │   │   └── en.php │   └── views │   └── welcome.blade.php └── routes ├── api.php └── web.php ``` -------------------------------- ### Install L5Modular via Composer Source: https://l5modular.github.io/getting-started Use this command in your project's root directory to install the L5Modular package. ```bash composer require artem-schander/l5-modular ``` -------------------------------- ### Generate Resource Controller with Model Source: https://l5modular.github.io/artisan-commands This example generates a RESTful resource controller for a 'Member' entity within the 'HelloWorld' module. It also prompts to create the 'Member' model if it doesn't exist. ```php php artisan make:module:controller MemberController --module=HelloWorld --model=Member ``` -------------------------------- ### Publish Configuration File Source: https://l5modular.github.io/configuration Execute this command to publish the configuration file to your project's config directory. ```bash php artisan vendor:publish ``` -------------------------------- ### List All Modules Source: https://l5modular.github.io/artisan-commands Use this command to view all modules registered in your application and their current status. ```bash php artisan module:list ``` -------------------------------- ### Custom Module Structure Configuration Source: https://l5modular.github.io/configuration Illustrates how to completely customize the file structure for a specific module, including routing and component paths. ```php return [ // ... 'specific' => [ 'HelloWorld' => [ 'routing' => [ 'simple' ], 'structure' => [ 'controllers' => 'Controllers', 'resources' => 'Resources', 'requests' => 'Requests', 'models' => 'Entities', 'views' => 'Views', 'translations' => 'Translations', 'routes' => '', 'migrations' => 'database/migrations', 'seeds' => 'database/seeds', 'factories' => 'database/factories', 'helpers' => '', ], ], ] ]; ``` -------------------------------- ### Change Module Routing Configuration Source: https://l5modular.github.io/configuration Demonstrates how to configure a module to use only a simple routing file. ```php return [ // ... 'specific' => [ 'HelloWorld' => [ 'routing' => [ 'simple' ], ], ] ]; ``` -------------------------------- ### Generate a New Module Source: https://l5modular.github.io/getting-started This Artisan command generates a basic 'HelloWorld' module. The generated controller, route, and view are ready for immediate use. ```bash php artisan make:module hello-world ``` -------------------------------- ### Generate a New Module Source: https://l5modular.github.io/artisan-commands Use this command to create a new module, including its folder structure. Configuration options can specify which components to generate. ```php php artisan make:module ``` -------------------------------- ### Module List Command Options Source: https://l5modular.github.io/artisan-commands This snippet shows the available options for the 'module:list' command, allowing for customization of output verbosity, environment, and interaction. ```bash Description: List the application's modules Usage: module:list Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --env[=ENV] The environment the command should run under -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug ``` -------------------------------- ### Enable a module (runtime) Source: https://l5modular.github.io/usage Use the `enable` method to temporarily enable a module for the current execution runtime. For permanent enabling, configure it in `config/modules.php`. ```php L5Modular::enable('HelloWorld'); ``` -------------------------------- ### Generate Module Helpers File Source: https://l5modular.github.io/artisan-commands This command generates a new helpers file within a module. Specify the module using the --module option. ```php php artisan make:module:helpers ``` -------------------------------- ### Render a module view Source: https://l5modular.github.io/usage Render a view file from a specific module using the double-colon syntax. ```php return view('HelloWorld::welcome'); ``` -------------------------------- ### Generate Route File in Module Source: https://l5modular.github.io/artisan-commands Use this command to create new route files within a module. Options like --simple, --web, and --api allow you to specify the type of route file, and --module targets the destination module. ```php php artisan make:module:route ``` -------------------------------- ### Default Module Structure Configuration Source: https://l5modular.github.io/configuration Defines the default directory structure for module components. Empty strings indicate components generated directly in the module folder. ```php 'structure' => [ 'controllers' => 'Http/Controllers', 'resources' => 'Http/Resources', 'requests' => 'Http/Requests', 'models' => 'Models', 'mails' => 'Mail', 'notifications' => 'Notifications', 'events' => 'Events', 'listeners' => 'Listeners', 'observers' => 'Observers', 'jobs' => 'Jobs', 'rules' => 'Rules', 'views' => 'resources/views', 'translations' => 'resources/lang', 'routes' => 'routes', 'migrations' => 'database/migrations', 'seeds' => 'database/seeds', 'factories' => 'database/factories', 'helpers' => '', ], ``` -------------------------------- ### Configure Module Generation Options Source: https://l5modular.github.io/configuration Define which components should be generated by the `php artisan make:module` command by setting boolean values in the 'generate' array. ```php 'generate' => [ 'controller' => true, 'resource' => false, 'request' => false, 'model' => true, 'mail' => false, 'notification' => false, 'event' => false, 'listener' => false, 'observer' => false, 'job' => false, 'rule' => false, 'view' => true, 'translation' => true, 'routes' => true, 'migration' => false, 'seeder' => false, 'factory' => false, 'config' => false, 'helpers' => false, ] ``` -------------------------------- ### Register module routes Source: https://l5modular.github.io/usage Register routes for a module by placing them in `routes/web.php` or `routes/api.php`. The service provider will load them automatically. ```php Route::resource('hello-world', 'HelloWorldController'); ``` -------------------------------- ### Configure Default Routing Types Source: https://l5modular.github.io/configuration Specify which route files will be generated and loaded. Supported types are 'web', 'api', and 'simple'. ```php 'routing' => [ 'web', 'api' ], ``` -------------------------------- ### Generate Migration File in Module Source: https://l5modular.github.io/artisan-commands This command generates a new migration file within a module. You can specify the table to be created with --create or the table to migrate with --table. The --module option targets the specific module. ```php php artisan make:module:migration ``` -------------------------------- ### Default Module Structure Source: https://l5modular.github.io/getting-started This is the standard file structure created for a new module by default. It includes essential directories for controllers, models, resources, and routes. ```text laravel-project/ app/ └── Modules/ └── HelloWorld ├── Http │   └── Controllers │   └── HelloWorldController.php ├── Models │   └── HelloWorld.php ├── resources │   ├── lang │   │   └── en.php │   └── views │   └── welcome.blade.php └── routes ├── api.php └── web.php ``` -------------------------------- ### Generate Listener Command Source: https://l5modular.github.io/artisan-commands Generates a new listener class within a specified module. Options allow defining the event and whether the listener should be queued. ```php php artisan make:module:listener ``` -------------------------------- ### Generate Module Config File Source: https://l5modular.github.io/artisan-commands Use this command to create a new configuration file within a module. The --module option allows you to specify the target module. ```php php artisan make:module:config ``` -------------------------------- ### Configure Default Module Settings Source: https://l5modular.github.io/configuration Set default routing types and module structure that will be applied to all modules unless overridden. ```php 'default' => [ /* |-------------------------------------------------------------------------- | Type Of Routing |-------------------------------------------------------------------------- | | If you need / don't need different route files for web and api | you can change the array entries like you need them. | | Supported: "web", "api", "simple" | */ 'routing' => [ 'web', 'api' ], /* |-------------------------------------------------------------------------- | Module Structure |-------------------------------------------------------------------------- | | In case your desired module structure differs | from the default structure defined here | feel free to change it the way you like it, | */ 'structure' => [ 'controllers' => 'Http/Controllers', 'resources' => 'Http/Resources', 'requests' => 'Http/Requests', 'models' => 'Models', 'mails' => 'Mail', 'notifications' => 'Notifications', 'events' => 'Events', 'listeners' => 'Listeners', 'observers' => 'Observers', 'jobs' => 'Jobs', 'rules' => 'Rules', 'views' => 'resources/views', 'translations' => 'resources/lang', 'routes' => 'routes', 'migrations' => 'database/migrations', 'seeds' => 'database/seeds', 'factories' => 'database/factories', 'helpers' => '', ], ], ``` -------------------------------- ### Disable a Module Configuration Source: https://l5modular.github.io/configuration Shows how to disable a specific module by setting its 'enabled' configuration to false. ```php return [ // ... 'specific' => [ 'HelloWorld' => [ 'enabled' => false, ], ] ]; ``` -------------------------------- ### Generate Resource in Module Source: https://l5modular.github.io/artisan-commands This command generates a new resource class within a specified module. It supports creating resource collections as well. ```php php artisan make:module:resource ``` ```bash php artisan make:module:resource PostResource --collection --module=Blog ``` -------------------------------- ### Generate Model in Module Source: https://l5modular.github.io/artisan-commands Use this command to create a new model class within a specific module. Options allow for generating associated components like migrations, seeders, factories, and controllers. ```php php artisan make:module:model ``` ```bash php artisan make:module:model Post --all --module=Blog ``` -------------------------------- ### Generate Observer Command Source: https://l5modular.github.io/artisan-commands Creates a new observer class for a module. You can specify the model the observer applies to and the module it should be generated in. ```php php artisan make:module:observer ``` -------------------------------- ### Check if a module exists Source: https://l5modular.github.io/usage Use the `exists` method to check if a module is available. It returns a boolean. ```php L5Modular::exists('HelloWorld'); ``` -------------------------------- ### Generate Module Seeder Source: https://l5modular.github.io/artisan-commands Use this command to create a new seeder class within a specific module. You can specify the module using the --module option. ```php php artisan make:module:seeder ``` -------------------------------- ### Load additional classes Source: https://l5modular.github.io/usage Load custom classes into a module by following PSR-4 autoloading standards. Ensure the file name matches the class name and the namespace is correct. ```php false, 'routing' => [ 'simple' ], 'structure' => [ 'controllers' => 'Controllers', 'views' => 'Views', 'translations' => 'Translations', ], ]; ``` -------------------------------- ### Generate a Module Controller Source: https://l5modular.github.io/artisan-commands Creates a new controller class within a specified module. Options allow for different controller types like API, resource, or invokable controllers. ```php php artisan make:module:controller ``` -------------------------------- ### Generate Blade View in Module Source: https://l5modular.github.io/artisan-commands Use this command to create a new Blade view file within a specific module. You can specify the module using the --module option. ```php php artisan make:module:view ``` -------------------------------- ### Generate Event in Module Source: https://l5modular.github.io/artisan-commands Generates a new event class within a specified module. The --module option defines the target module. ```php php artisan make:module:event ``` -------------------------------- ### Generate Mail in Module Source: https://l5modular.github.io/artisan-commands Generates a new mail class within a specified module. Options allow for force creation and markdown view generation. ```php php artisan make:module:mail ``` -------------------------------- ### Generate Module Factory Source: https://l5modular.github.io/artisan-commands This command generates a new model factory within a module. You can specify the module and the associated model using the --module and -m options respectively. ```php php artisan make:module:factory ``` -------------------------------- ### Generate Notification in Module Source: https://l5modular.github.io/artisan-commands Generates a new notification class within a specified module. Options include force creation and markdown view generation. ```php php artisan make:module:notification ``` -------------------------------- ### Generate Rule Command Source: https://l5modular.github.io/artisan-commands Creates a new validation rule class for a module. The --module option specifies the module where the rule will be generated. ```php php artisan make:module:rule ``` -------------------------------- ### Generate Translation File in Module Source: https://l5modular.github.io/artisan-commands This command generates a new translation file for a specified language within a module. The --module option allows you to target a particular module. ```php php artisan make:module:translation ``` -------------------------------- ### Generate Job Command Source: https://l5modular.github.io/artisan-commands Generates a new job class within a module. Options include specifying if the job should be synchronous and the target module. ```php php artisan make:module:job ``` -------------------------------- ### Module Custom Configuration Source: https://l5modular.github.io/configuration Adds custom configuration values to a module, which can be accessed alongside package-specific settings. This configuration is merged with the main module configuration. ```php return [ 'enabled' => true, 'custom' => 1337, ]; ``` -------------------------------- ### Translate module strings Source: https://l5modular.github.io/usage Access translation strings from a specific module using the double-colon syntax. ```php echo trans('HelloWorld::example.welcome'); ``` -------------------------------- ### Check if a module is disabled Source: https://l5modular.github.io/usage Use the `disabled` method to check if a module is currently disabled. It returns a boolean. ```php L5Modular::disabled('HelloWorld'); ``` -------------------------------- ### Disable a module (runtime) Source: https://l5modular.github.io/usage Use the `disable` method to temporarily disable a module for the current execution runtime. For permanent disabling, configure it in `config/modules.php`. ```php L5Modular::disable('HelloWorld'); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.