Skip to content

Latest commit

 

History

History
104 lines (75 loc) · 2.18 KB

2-Configuration.md

File metadata and controls

104 lines (75 loc) · 2.18 KB

2. Configuration

Table of contents

  1. Installation and Setup
  2. Configuration
  3. Usage

Settings

Default:

<?php

// config/settings.php

return [
    /* -----------------------------------------------------------------
     |  Default drivers
     | -----------------------------------------------------------------
     | Supported: 'array', 'json', 'database', 'redis'
     */

    'default' => 'json',

    // ...
];

You can specify here your default store driver that you would to use.

Drivers:

<?php

// config/settings.php

return [
    //...
    
    /* -----------------------------------------------------------------
     |  Drivers
     | -----------------------------------------------------------------
     */

    'drivers' => [

        'array' => [
            'driver'  => Arcanedev\LaravelSettings\Stores\ArrayStore::class,
        ],

        'json' => [
            'driver'  => Arcanedev\LaravelSettings\Stores\JsonStore::class,

            'options' => [
                'path'   => storage_path('app/settings.json'),
            ],
        ],

        'database' => [
            'driver'  => Arcanedev\LaravelSettings\Stores\DatabaseStore::class,

            'options' => [
                'connection' => null,
                'table'      => 'settings',
                'model'      => \Arcanedev\LaravelSettings\Models\Setting::class,
            ],
        ],

        'redis' => [
            'driver'  => Arcanedev\LaravelSettings\Stores\RedisStore::class,

            'options' => [
                'client' => 'predis',

                'default' => [
                    'host'     => env('REDIS_HOST', '127.0.0.1'),
                    'port'     => env('REDIS_PORT', 6379),
                    'database' => env('REDIS_DB', 0),
                ],
            ],
        ],
    ],
];

This is the list of the supported store drivers. You can expand this list by adding a custom store driver.

The store config is structured like this:

<?php 

// ...
'custom' => [
    'driver'  => App\Stores\CustomStore::class,
    
    'options' => [
        // ...
    ],
],