定制 artem-alekseev/dictionaries 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

artem-alekseev/dictionaries

最新稳定版本:v1.0.8

Composer 安装命令:

composer require artem-alekseev/dictionaries

包简介

Use dictionary in laravel

README 文档

README

Composer

How install package

composer require artem-alekseev/dictionaries:1.*

Usage

Make Dictionary

Use laravel artisan command

php artisan make:dictionary NameDictionary

In dictionary

class NameDictionary extends Dictionary
{
    const ONE = 1;
    const TWO = 2;
    
    public static function getDictionary(): array
    {
        return [
            self::ONE => 'One',
            self::TWO => 'Two',
        ];
    }
}

Use in code

echo NameDictionary::ONE; // out 1
echo NameDictionary::getValueData($this->id); // id = 2 // out 'Two'
echo NameDictionary::getRange(); // out [1,2] use in validation
echo NameDictionary::getStringRange(); // out '1,2' use in validation
echo NameDictionary::getDictionary() // out [1 => 'One', 2 => 'Two'] use in selector form field

License

This project is licensed under the MIT License - see the LICENSE.md file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-26