Commit 8b46e869 by lujunyi

医药简码

parent 9131d414
...@@ -36,10 +36,8 @@ class DrugModel extends Model ...@@ -36,10 +36,8 @@ class DrugModel extends Model
self::RX_FALSE => '否', self::RX_FALSE => '否',
]; ];
public function setNameAttribute($value) public function setCodeAttribute($value)
{ {
$this->attributes['name'] = $value;
$pinyin = new Pinyin(); $pinyin = new Pinyin();
$abbr = $pinyin->abbr($this->name)->join(''); // 获取拼音首字母 $abbr = $pinyin->abbr($this->name)->join(''); // 获取拼音首字母
$this->attributes['code'] = strtoupper($abbr); $this->attributes['code'] = strtoupper($abbr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment