|
@@ -131,28 +131,21 @@ class AssetController extends Controller
|
|
|
|
|
|
public function tree()
|
|
|
{
|
|
|
- $assetsAttachmentArray = [];
|
|
|
- $assets = Asset::allowed()->get(['id', 'name', 'parent_id'])->each(function ($assets) use(&$assetsAttachmentArray){
|
|
|
-
|
|
|
-
|
|
|
- $asset =new Asset();
|
|
|
- $asset ->parent_id = $assets->id;
|
|
|
- $asset ->type = 'attachment';
|
|
|
- $asset->uniId='attachment_'.$assets->id;
|
|
|
- $asset->id = 123456789;
|
|
|
- $assetsAttachmentArray[]=[
|
|
|
- "parent_id"=>$assets->id,
|
|
|
- "type"=>'attachment',
|
|
|
- "name" => 'attachment',
|
|
|
- "uniId"=>'attachment_'.$assets->id,
|
|
|
- "id"=>rand(15,100)*rand(15,100)*rand(15,100),
|
|
|
- ];
|
|
|
+ $attachmentArray = [];
|
|
|
+ $assets = Asset::allowed()->get(['id', 'name', 'parent_id'])->each(function ($assets)use (&$attachmentArray){
|
|
|
+ $attachmentArray[]=[
|
|
|
+ 'parent_id'=>$assets->id,
|
|
|
+ 'type'=>'attachment',
|
|
|
+ 'name'=>'attachment',
|
|
|
+ 'uuId'=>'attachment_'.$assets->id,
|
|
|
+ 'id'=>'asset_id_'.$assets->id,
|
|
|
+ ];
|
|
|
$assets->type='asset';
|
|
|
$assets->uniId=$assets->type.'_'.$assets->id;
|
|
|
});
|
|
|
|
|
|
return $this->success([
|
|
|
- 'data' => make_tree(array_merge($assets->toArray(),$assetsAttachmentArray))
|
|
|
+ 'data' => make_tree(array_merge($assets->toArray(),$attachmentArray))
|
|
|
]);
|
|
|
}
|
|
|
}
|