* @return \think\model\relation\HasMany */ public function icons() { return $this->hasMany('IconList', 'icon_id')->field('title,class,code'); } /** * 获取图标css链接 * @author 蔡伟明 <314013107@qq.com> * @return array|string|\think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public static function getUrls() { $list = self::where('status', 1)->select(); if ($list) { foreach ($list as $key => $item) { if ($item['icons']) { $html = ''; } else { $html = '

暂无图标

'; } $list[$key]['html'] = $html; } } return $list; } }