1, 'name' => '商品'], ['id' => 3, 'name' => '网址'], ]; public $BannerList = [ ['bm' => 'carousel', 'name' => '首页轮播图','cc'=>'750*500'], ['bm' => 'merchant', 'name' => '首页精品推荐','cc'=>'710*289'], ['bm' => 'goods', 'name' => '产品列表','cc'=>'710*240'], ]; public function getJumpTypeTextAttr($value, $data) { $result = '--'; foreach ($this->jumpType as $item) { if ($data['jump_type'] == $item['id']) { $result = $item['name']; break; } } return $result; } public function getJumpTargetTextAttr($value, $data) { $result = '--'; switch ($data['jump_type']) { case 1: $result = Goods::where('id', $data['jump_target'])->value('name'); break; case 3: $result = $data['jump_target']; break; default: break; } return $result; } }