Looking to hire Laravel developers? Try LaraJobs

laravel-settings maintained by pkg6

Description
Store Laravel application settings in the database.
Author
Last update
2024/12/25 08:44 (dev-main)
License
Links
Downloads
203

Comments
comments powered by Disqus

安装

composer require pkg6/laravel-settings

config/app.php 注册

'providers' => [
    .....
    \Pkg6\Laravel\Settings\SettingsServiceProvider::class
]

php artisan vendor:publish --provider="\Pkg6\Laravel\Settings\SettingsServiceProvider::class"
php artisan vendor:publish --tag="settings"

php artisan migrate --path=database/migrations/2024_12_16_122545_create_settings_table.php

基本使用

// Setting
Settings::set('foo', 'bar');
settings()->set('foo', 'bar');
settings(['foo' => 'bar']);

// Retrieving
Settings::get('foo'); // 'bar'
settings()->get('foo');
settings('foo');