在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):akaunting/laravel-setting开源软件地址(OpenSource Url):https://github.com/akaunting/laravel-setting开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):Persistent settings package for LaravelThis package allows you to save settings in a more persistent way. You can use the database and/or json file to save your settings. You can also override the Laravel config.
Getting Started1. InstallRun the following command: composer require akaunting/laravel-setting 2. Register (for Laravel < 5.5)Register the service provider in Akaunting\Setting\Provider::class, Add alias if you want to use the facade. 'Setting' => Akaunting\Setting\Facade::class, 3. PublishPublish config file. php artisan vendor:publish --tag=setting 4. DatabaseCreate table for database driver php artisan migrate 5. ConfigureYou can change the options of your app from UsageYou can either use the helper method like FacadeSetting::get('foo', 'default');
Setting::get('nested.element');
Setting::set('foo', 'bar');
Setting::forget('foo');
$settings = Setting::all(); Helpersetting('foo', 'default');
setting('nested.element');
setting(['foo' => 'bar']);
setting()->forget('foo');
$settings = setting()->all(); You can call the Auto SaveIf you enable the Blade DirectiveYou can get the settings directly in your blade templates using the helper method or the blade directive like Override Config ValuesYou can easily override default config values by adding them to the 'override' => [
"app.name" => "app_name",
"app.env" => "app_env",
"mail.driver" => "app_mail_driver",
"mail.host" => "app_mail_host",
], The values on the left corresponds to the respective config value (Ex: config('app.name')) and the value on the right is the name of the EncryptionIf you like to encrypt the values for a given key, you can pass the key to the 'encrypted_keys' => [
"payment.key",
], JSON StorageYou can modify the path used on run-time using Database StorageIf you want to use the database as settings storage then you should run the Extra ColumnsIf you want to store settings for multiple users/clients in the same database you can do so by specifying extra columns: setting()->setExtraColumns(['user_id' => Auth::user()->id]); where If you need more fine-tuned control over which data gets queried, you can use the
setting()->setConstraint(function($query, $insert) {
if ($insert) return;
$query->where(/* ... */);
}); Custom DriversThis package uses the Laravel class MyDriver extends Akaunting\Setting\Contracts\Driver
{
// ...
}
app('setting.manager')->extend('mydriver', function($app) {
return $app->make('MyDriver');
}); ChangelogPlease see Releases for more information what has changed recently. ContributingPull requests are more than welcome. You must follow the PSR coding standards. SecurityIf you discover any security related issues, please email [email protected] instead of using the issue tracker. CreditsLicenseThe MIT License (MIT). Please see LICENSE for more information. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论