| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Admin\Renderable;
- use Dcat\Admin\Support\LazyRenderable;
- use Dcat\Admin\Widgets\Table;
- class BoxRecordAttiresTable extends LazyRenderable
- {
- //
- public function render() {
- // 获取ID
- $ids = explode(",",$this->ids);
- $tmp = \App\Models\GiftBox::withTrashed()
- ->whereIn('id', $ids)
- ->with(['attire'])
- ->get()
- ->toArray();
- //
- $tmp = array_column($tmp, null, 'id');
- //
- $data = [];
- foreach($ids as $id) {
- $t = [
- 'id' => $tmp[$id]['attire_id'],
- 'name' => $tmp[$id]['attire']['name'],
- 'level' => $tmp[$id]['attire']['level'],
- 'img_1' => "<img src='".\Storage::disk('cosv5')->url($tmp[$id]['attire']["img_1"])."' style='width:60px;height:auto;'/>",
- 'img_2' => "<img src='".\Storage::disk('cosv5')->url($tmp[$id]['attire']["img_2"])."' style='width:60px;height:auto;'/>",
- 'cate' => $tmp[$id]['attire']['cate'],
- ];
- $data[] = $t;
- }
- //
- $titles = [
- '装扮ID',
- '名称',
- '级别',
- '正面图片',
- '背面图片',
- '类别',
- ];
- return Table::make($titles, $data);
- }
- }
|