pixeo/laravel-settings

为 Laravel 应用提供简单的持久化设置包

4.0.0 2022-03-14 14:15 UTC

This package is auto-updated.

Last update: 2024-09-14 20:20:15 UTC


README

Latest Version on Packagist Build Status Total Downloads

在数据库中持久化您的设置

安装

您可以通过 composer 安装此包

composer require pixeo/laravel-settings

包将自动注册自己。

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="Pixeo\Settings\SettingServiceProvider" --tag="config"

这是发布配置文件的内容

<?php

return [
    /*
     * The model that is used to fetch the settings
     */
    'model' => Pixeo\Settings\Setting::class,

    /**
     * The cache key the package will use
     */
    'cache_key' => 'pixeo.settings',
];

使用方法

\Pixeo\Settings\Setting::create(['key' => 'foo', 'value' => 'bar']);
echo setting('foo'); // => bar

测试

composer test

致谢

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅许可证文件