where('id',$row['pid'])->value('tid'); Db::name('jishuguifan')->where('id',$row['id'])->update(['tid'=>$tid]); }); self::beforeUpdate(function ($row) { $tid = Db::name('jishuguifan')->where('id',$row['pid'])->value('tid'); Db::name('jishuguifan')->where('id',$row['id'])->update(['tid'=>$tid]); }); } public function getIsmenuList() { return ['1' => __('Ismenu 1'), '0' => __('Ismenu 0')]; } public function getIsmenuTextAttr($value, $data) { $value = $value ? $value : (isset($data['ismenu']) ? $data['ismenu'] : ''); $list = $this->getIsmenuList(); return isset($list[$value]) ? $list[$value] : ''; } public function company() { return $this->belongsTo('Company', 'company_id', 'id', [], 'LEFT')->setEagerlyType(0); } }