Commit 4e7ae425 by lujunyi

诊断

parent f32612a4
......@@ -23,6 +23,7 @@ protected function grid()
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('code');
$grid->column('encoding');
$grid->column('content');
$grid->filter(function (Grid\Filter $filter) {
......@@ -31,6 +32,7 @@ protected function grid()
$filter->like('name')->width(3);
$filter->like('code')->width(3);
$filter->like('encoding')->width(3);
$filter->like('content')->width(3);
});
......@@ -77,8 +79,8 @@ protected function form()
$form->display('id')->width(4);
$form->text('name')->width(4)->required()->maxLength(128, '最多输入128个字符');
$form->text('content')->width(4)->required()->maxLength(255, '最多输入255个字符');
$form->text('encoding')->width(4)->required()->maxLength(128);
$form->display('code')->width(4);
$form->display('encoding')->width(4);
$form->display('created_at')->width(4);
$form->display('updated_at')->width(4);
......
......@@ -15,8 +15,10 @@ class DiagnosiModel extends Model
protected $table = 'diagnosis';
public function setCodeAttribute($value)
public function setNameAttribute($value)
{
$this->attributes['name'] = $value;
$pinyin = new Pinyin();
$abbr = $pinyin->abbr($this->name)->join(''); // 获取拼音首字母
$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