This commit is contained in:
2025-10-22 20:08:22 +05:00
commit 736e3bef18
2573 changed files with 120385 additions and 0 deletions

48
.cursor-rules.yaml Normal file
View File

@@ -0,0 +1,48 @@
# This file defines conventions for the modular system in the Laravel application.
# By following these rules, we can ensure consistency and maintainability across the codebase.
# GENERAL OVERVIEW
# The application uses a modular architecture to organize features into distinct, reusable units.
# Modules are located in the `app/Modules` directory. Each subdirectory in this directory is considered a module.
# The core logic for module discovery and registration is handled by `App\Modules\ModuleRepository` and `App\Providers\ModuleServiceProvider`.
# KEY FILES
# - `app/Providers/ModuleServiceProvider.php`: Registers and boots all active modules. This is where module resources (configs, migrations, routes, views, etc.) are loaded.
# - `app/Modules/ModuleRepository.php`: Discovers modules from the filesystem.
# - `app/Modules/ModuleContract.php`: The interface that each module's main class must implement.
# - `app/Modules/BaseModule.php`: A base class for module data.
# - `app/Modules/module-helpers.php`: Global helper functions for interacting with the modular system.
# CONVENTIONS
rules:
- name: "Modular Architecture"
description: |
The application is divided into modules, located in `app/Modules`. Each module is a self-contained unit with its own resources.
When adding new high-level functionality, consider creating a new module for it.
- name: "Creating a New Module"
description: |
To create a new module named "MyModule", follow these steps:
1. Create a new directory `app/Modules/MyModule`.
2. Create the main module class `app/Modules/MyModule/MyModuleModule.php`. This class must implement `\App\Modules\ModuleContract`.
3. Implement the `isEnabled()` method in `MyModuleModule.php` to control if the module is active.
4. Add resources to your module following the structure defined in `ModuleServiceProvider`:
- Configs: `app/Modules/MyModule/Configs/my-module-config.php`
- Migrations: `app/Modules/MyModule/Database/Migrations/`
- Views: `app/Modules/MyModule/Resources/Views/`
- Routes: `app/Modules/MyModule/Routes/my-module-routes.php`
- Helpers: `app/Modules/MyModule/my-module-helpers.php`
- Translations: `app/Modules/MyModule/Resources/lang/`
- name: "Enabling/Disabling Modules"
description: |
A module can be enabled or disabled via its `isEnabled()` method in the main module class (e.g., `MyModuleModule.php`).
The `ModuleServiceProvider` only boots enabled modules.
- name: "Interacting with Modules"
description: |
Use the helper functions defined in `app/Modules/module-helpers.php` to work with modules:
- `modules()`: Get a collection of all enabled modules.
- `module('MyModule')`: Get an instance of a specific module's main class.
- `modules_path()`: Get the absolute path to the modules directory.