|
@@ -12,6 +12,7 @@ use App\Models\Enums\ActionObjectType;
|
|
|
use App\Models\Enums\FileObjectType;
|
|
|
use App\Models\Enums\ObjectAction;
|
|
|
use App\Models\File;
|
|
|
+use App\Models\Folder;
|
|
|
use App\Repositories\ActionRepository;
|
|
|
use App\Services\NamingRule\NamingRuleCheck;
|
|
|
use Illuminate\Http\Request;
|
|
@@ -187,6 +188,9 @@ trait FilesUploadTrait
|
|
|
|
|
|
protected function storeFiles(array $items)
|
|
|
{
|
|
|
+ $folderIds = array_filter(array_column($items, 'folder_id'));
|
|
|
+ $folders = Folder::query()->where(['id' => $folderIds])->get();
|
|
|
+
|
|
|
$uploadedFiles = [];
|
|
|
foreach ($items as $item) {
|
|
|
$fileInfo = $item['file'];
|
|
@@ -212,7 +216,7 @@ trait FilesUploadTrait
|
|
|
'is_latest_version' => 0
|
|
|
]);
|
|
|
}
|
|
|
-
|
|
|
+ $fileInfo['naming_rule_id'] = $folders->firstWhere('id', $fileInfo['folder_id'] ?? 0)?->naming_rule_id;
|
|
|
$file = File::query()->create($fileInfo);
|
|
|
|
|
|
if (isset($item['bim']) && $item['bim']) {
|