bkstar123/laratune

一个轻量级的 Laravel 扩展包,提供对应用程序数据库持久化的键值设置的调整能力

1.0.2 2020-03-09 15:38 UTC

This package is auto-updated.

Last update: 2024-09-10 01:29:09 UTC


README

一个轻量级的 Laravel 扩展包,提供对应用程序数据库持久化的键值设置的调整能力

1. 要求

建议使用 PHP 版本 7.1.3+ 和 Laravel 框架版本 5.6+ 来安装此包

2. 安装

composer require bkstar123/laratune

运行 php artisan migrate 命令以创建用于存储键值设置的 settings

3. 使用

<?php
Setting::get('sitename', 'Default Site Name'); // same result as config('settings.sitename', 'Default Site Name')
Setting::set('sitename', 'YourSiteName'); // Define a key & value pair in settings table and load it to config('settings')
Setting::all(); // Get a collection of all records in settings table
Setting::forget('sitename'); // Delete a key & value pair from setting tables and unload it from config('settings')
Setting::purge(); // Truncate settings table and unload the entire config('settings') array