承接 core45/system-settings-db 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

core45/system-settings-db

最新稳定版本:0.1.5

Composer 安装命令:

composer require core45/system-settings-db

包简介

Get system settings for your Laravel app from database

README 文档

README

Very simple package for storing settings for your Laravel project in the database.

Installation

Install the package with composer:

composer require core45/system-settings-db

Publish the package files:

php artisan vendor:publish --provider="Core45\SystemSettingsDb\SystemSettingsDbServiceProvider"

Migrate the database:

php artisan migrate

Usage

After migrating the new table system_settings will be created in the database. The package doesn't provide a UI for managing the settings. You have to add/modify/delete the records on your own. The important columns are:

  • key: the key of the setting
  • value: the value of the setting

The other columns are for your convenience. You can also add your own columns to the table if you like.

Setting a value

In the database you can set a value for a key. The key is a string and the value can be a string, integer or boolean.

To access the value of a key you can use the config() helper function.

config('system-settings.some-key');

So for example in your blade template you can use your contact email you previously stored in the settings table:

My email is: <a href="mailto:{{ config('system-settings.email') }}">{{ config('system-settings.email') }}</a>

Cache

The package uses the Laravel cache so if you'd like to see the changes immediately clean the Laravel cache. Default TTL of the cache is 60 seconds. You can change this setting in the config file.

License

MIT

统计信息

  • 总下载量: 1.07k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-10