@@ -29,20 +29,20 @@ Allows modules structure of your project. Each module can have its views, config
2929 1. Modify the `config/modules.php` config file as needed.
3030
3131## How It Works
32- Your modules should go in a root modules folder. By default this is `app/Modules` which maps to the namespace
32+ Your modules should go in a root modules folder. By default this is `app/Modules` which maps to the namespace
3333`\App\Modules`.
3434
35- Each of your modules will have its own folder inside the modules root folder, the folder will be named after the module
35+ Each of your modules will have its own folder inside the modules root folder, the folder will be named after the module
3636name, and will map to the namespace `\App\Modules\{ModuleName}`.
3737
38- Each module will contain a base module definition class, which (by default) will be named `Module.php` and maps to
38+ Each module will contain a base module definition class, which (by default) will be named `Module.php` and maps to
3939the namespace `\App\Modules\{ModuleName}\Module`. This class will act as the key generator for the module URLs, routes,
4040and other framework-related values.
4141
4242Each module will contain its data models, controllers, views, routes, and other project files as usual. The `composer`
4343PSR-4 loader should take care of loading your module files and classes properly.
4444
45- Your module controllers (by default go into the `Http/Controllers` folder) should inherite the
45+ Your module controllers (by default go into the `Http/Controllers` folder) should inherite the
4646`ItvisionSy\Laravel\Modules\Controller` class to make views rendering and other tasks easier.
4747
4848## Creating Modules
@@ -52,30 +52,31 @@ php artisan modules:make {id} {name} [--url={url}]
5252```
5353Values of `id`, `name`, and `url` are strings, and the URL part is optional and will be used to generate make the
5454 URLs of the module more human friendly.
55-
55+
5656This command will create the basic folder structure inside the modules folder, along with the base module and a sample
5757routes (inside `Http/routes.php`), controller (inside `Http/Controllers/`), and view (inside `Views`).
5858
5959As you have the basic structure, you can start creating your files and classes as normal. Nothing special to worry about.
6060
6161## What is Store Handler
62- It is a feature allows a per-module configuration to be saved in the database, in addition to a flag to identify if a
62+ It is a feature allows a per-module configuration to be saved in the database, in addition to a flag to identify if a
6363module is enabled or disabled.
6464
6565You need a class that implements the `ItvisionSy\Laravel\Modules\Interfaces\KeyValueStoreInterface` interface, which
6666defines two methods: `set($key, $value)` and `get($key, $default=null)`.
6767
68- There is a ready made implementation in the `\ItvisionSy\Laravel\Modules\StoreHandlers\SimpleDbStoreHandler` class,
69- which utilizes a DB connection (default one by default) to store the config in a simple key/value table.
68+ There are two ready-made implementations in the `\ItvisionSy\Laravel\Modules\StoreHandlers\` namespace, one is calle
69+ `MysqlSimpleDbStoreHandler` and the other `SqliteSimpleDbStoreHandler`, which utilizes a DB connection (default one
70+ by default) to store the config in a simple key/value table.
7071
7172The feature comes disabled by default by setting the class `\ItvisionSy\Laravel\Modules\StoreHandlers\DummyStoreHandler`
72- as the store handler. To enable it, just change the `store_handler` config setting in the `config/modules.php` config
73- file to use the `SimpleDbStoreHandler` class mentioned above.
73+ as the store handler. To enable it, just change the `store_handler` config setting in the `config/modules.php` config
74+ file to use one of the two classes mentioned above.
7475```php
7576//config/modules.php config file
76- return [
77- 'store_handler' => \ItvisionSy\Laravel\Modules\StoreHandlers\SimpleDbStoreHandler ::class,
78- ];
77+
78+ 'store_handler' => \ItvisionSy\Laravel\Modules\StoreHandlers\SqliteSimpleDbStoreHandler ::class,
79+
7980```
8081
8182Also, you need to create the database table for the store. We provided a simple artisan command to do that. After you
@@ -84,7 +85,7 @@ have configured everything correctly, simply execute the following command:
8485which will take care about creating the database table by executing the following SQL command:
8586``` sql
8687CREATE TABLE IF NOT EXISTS ` modules_storage` (
87- ` key` VARCHAR (200 ) UNIQUE NOT NULL PRIMARY KEY ,
88+ ` key` VARCHAR (200 ) UNIQUE NOT NULL PRIMARY KEY ,
8889 ` value` VARCHAR (200 ) NULL
8990);
9091```
0 commit comments