null, 'asset_id' => null, 'project_id' => null, 'library_id' => null, 'container_id' => null, 'folder' => null, 'object_id' => intval($objectId), 'object_type' => $objectType, ]; $model = ActionObjectType::from($objectType)->modelBuilder()->findOrFail($objectId); switch ($objectType) { case ActionObjectType::CONTAINER_FILE->value: $data['folder'] = (new FoldersService())->getAllParentTree($model->folder_id); $data['container_id'] = $model->container?->id; $data['library_id'] = $model->library?->id; $data['asset_id'] = $model->library?->asset_id; $data['project_id'] = $model->library?->project_id; $data['type'] = $model->library?->type; break; case ActionObjectType::FOLDER->value: $data['folder'] = (new FoldersService())->getAllParentTree($model->id); $data['container_id'] = $model->container?->id; $data['library_id'] = $model->library?->id; $data['asset_id'] = $model->library?->asset_id; $data['project_id'] = $model->library?->project_id; $data['type'] = $model->library?->type; break; case ActionObjectType::CONTAINER->value: $data['container_id'] = $model->id; $data['library_id'] = $model->library?->id; $data['asset_id'] = $model->library?->asset_id; $data['project_id'] = $model->library?->project_id; $data['type'] = $model->library?->type; break; case ActionObjectType::LIBRARY->value: $data['library_id'] = $model->id; $data['asset_id'] = $model->asset_id; $data['project_id'] = $model->project_id; $data['type'] = $model->type; default: break; } return $this->success(['data' => $data]); } }