ConfigModel.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Models;
  12. /**
  13. * 配置管理-模型
  14. * @author laravel开发员
  15. * @since 2020/11/11
  16. * Class ConfigModel
  17. * @package App\Models
  18. */
  19. class ConfigModel extends BaseModel
  20. {
  21. // 设置数据表
  22. protected $table = 'config';
  23. public function getInfo($id)
  24. {
  25. $info = parent::getInfo($id); // TODO: Change the autogenerated stub
  26. if($info){
  27. $type = isset($info['type'])? $info['type'] : 'text';
  28. if(isset($info['value']) && $type=='image'){
  29. $info['value'] = get_image_url($info['value']);
  30. }
  31. if(isset($info['value']) && $type=='daterange'){
  32. $info['value'] = json_decode($info['value'], true);
  33. }
  34. }
  35. return $info;
  36. }
  37. }