|
1 | 1 | # Module Admin Configuration
|
2 | 2 |
|
3 |
| -`AdminConfiguration` facade is very helpful for adding an configuration for your custom module. Let say you want add a configuration for your shipping module of AvoRed E commerce. You can do that simply adding into your `module.php` files `boot` method by registering an AdminConfiguration. |
| 3 | +Admin configuration is a way to storing the system level values into a database and as a module developer can use those values into different stages of an module. |
4 | 4 |
|
5 |
| -```php |
6 |
| -use AvoRed\Framework\AdminConfiguration\Facade as AdminConfigurationFacade; |
| 5 | +Admin Configuration is now part of an `\AvoRed\Framework\Support\Facades\Tab` facade. Only the thing that have to keep in mind that when you register a tab for a Admin Configuration make the key stay intact with the existing `avored/framework`. |
| 6 | + |
| 7 | +Let me give you an example: Let say you want to add a configuration for a AvoRed Pickup shipping module and you want to add configuration regarding that. In this situation you can simple open your `Module.php@boot` method and add the below code to register an tab. |
7 | 8 |
|
8 | 9 |
|
9 |
| -// How to add a new Configuration Tab/Accordion |
10 |
| -$configurationGroup = AdminConfigurationFacade::add('my_custom_accordion')->label('My Custom Accordion'); |
| 10 | +```php |
| 11 | +use AvoRed\Framework\Support\Facades\Tab; |
| 12 | +use AvoRed\Framework\Tab\TabItem; |
11 | 13 |
|
12 |
| -// How to add a new Configuration Tab/Accordion |
13 |
| -$paymentGroup = AdminConfigurationFacade::get('payment'); |
14 | 14 |
|
15 |
| -$paymentGroup->addConfiguration('shipping_free_shipping_enabled') |
16 |
| - ->label('Is Free Shipping Enabled') |
17 |
| - ->type('select') |
18 |
| - ->name('shipping_free_shipping_enabled') |
19 |
| - ->options(function (){ |
20 |
| - $options = [1 => 'Yes' , 0 => 'No']; |
21 |
| - return $options; |
| 15 | +// How to add a new Admin Configuration Tab |
| 16 | +@note Check the Tab Key here. Make sure do not change the ***system.confuguration*** as a key. |
| 17 | +Tab::put('system.configuration', function (TabItem $tab) { |
| 18 | + $tab->key('system.configuration.pickup') |
| 19 | + ->label('avored-pickup::system.config-title') |
| 20 | + ->view('avored-pickup::system.configuration.pickup'); |
22 | 21 | });
|
23 | 22 | ```
|
24 | 23 |
|
0 commit comments