letsgoi/laravel-settings 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

letsgoi/laravel-settings

最新稳定版本:4.0.1

Composer 安装命令:

composer require letsgoi/laravel-settings

包简介

Laravel settings package

README 文档

README

Move your env variables to database to change them easily using laravel nova

Requirements

  • PHP >= 8.3
  • Laravel >= 10.0
  • Laravel nova license registered on project

Installation

  • Require package with composer:
composer require letsgoi/laravel-settings
  • Add Letsgoi\LaravelSettings\SettingsServiceProvider::classto app.php
    /*
     * Package Service Providers...
     */
    ...
    Letsgoi\LaravelSettings\SettingsServiceProvider::class,
  • Publish configuration:
php artisan vendor:publish --provider="Letsgoi\LaravelSettings\SettingsServiceProvider" --tag="migrations"
  • Add SettingNovaResource::class on NovaServiceProvider.php
    protected function resources(): void
    {
        Nova::resources([
            ...
            SettingNovaResource::class,
        ]);
    }

Usage

This package use cache memory to save variables, instead of retrieving them from database each time you need to use it:

  1. When you save a variable, cache of this variable is cleared.
  2. First time you retrieve a variable it is saved to cache.

To register a new variable on Settings:

  1. Create a migration with the name and key of the variable:
    1. The available types are: bool, string, float, array
    DB::table('settings')->insert([
            'id' => 'APP_URL',
            'type' => 'string'
    ]);
  1. Run migrations: php artisan migrate
  2. Access your nova url and fill the variable with the value: For booleans use 0 (false) and 1 (true).
  3. Use variable in your code using:
    $settingRepository = new SettingRepository();
    
    $value = $settingRepository->find('key');

Testing

Run tests: composer test

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固