This package allows you to save settings in the database. Multi-Tenancy is supported out of the box.
composer require ctsoft/laravel-database-settings
The usage is the same as config
in the Laravel framework.
// Facade
Settings::set('foo', 'bar');
Settings::set(['foo' => 'bar', 'myarr.key1' => true, 'myarr.key2' => 5.87]);
Settings::get('foo');
Settings::get('myarr.key1');
// Helper
setting(['foo' => 'bar']);
setting('foo');
If you want to change the configuration of the package publish the configuration file and see the next sections.
php artisan vendor:publish --provider="CTSoft\Laravel\DatabaseSettings\Providers\DatabaseSettingsProvider" --tag=config
In the package configuration file you can define default values which should be used if a setting does not exist.
[
'foo' => 'myval',
'myarr' => [
'key1' => false,
],
]
In the package configuration file you can define which settings should be encrypted in the database.
[
'bar',
'myarr' => [
'key2',
],
]
This package supports the following multi-tenancy packages:
- Stancl Multi Database
- Stancl Single Database
To use tenancy support you must define it in the package configuration file. If you use any other multi-tenancy package please study the source code of this package. It is easy to add your own tenancy support.
If you want to adjust the database table publish the migration files.
php artisan vendor:publish --provider="CTSoft\Laravel\DatabaseSettings\Providers\DatabaseSettingsProvider" --tag=migrations
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Laravel Database Settings is open-sourced software licensed under the MIT license.