pkg6/laravel-settings

Store Laravel application settings in the database.

v1.0.0 2024-12-17 07:47 UTC

This package is auto-updated.

Last update: 2024-12-18 07:17:28 UTC


README

安装

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');