mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-22 09:32:14 +00:00
controller refactoring part 22
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Domain\Files\Actions;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\ImageManagerStatic as Image;
|
||||
|
||||
@@ -16,8 +13,7 @@ class CreateImageThumbnailAction
|
||||
string $file_path,
|
||||
string $filename,
|
||||
string $user_id
|
||||
): string|null {
|
||||
|
||||
): string | null {
|
||||
$availableFormats = ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'];
|
||||
|
||||
// Create thumbnail from image
|
||||
@@ -45,4 +41,4 @@ class CreateImageThumbnailAction
|
||||
|
||||
return $thumbnail ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Domain\Files\Actions;
|
||||
|
||||
|
||||
use Aws\Exception\MultipartUploadException;
|
||||
use Aws\S3\MultipartUploader;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Aws\Exception\MultipartUploadException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class MoveFileToExternalStorageAction
|
||||
@@ -16,9 +13,9 @@ class MoveFileToExternalStorageAction
|
||||
* Move file to external storage if is set
|
||||
*/
|
||||
public function __invoke(
|
||||
string $file, string $user_id
|
||||
string $file,
|
||||
string $user_id
|
||||
): void {
|
||||
|
||||
$disk_local = \Storage::disk('local');
|
||||
|
||||
// Get file size
|
||||
@@ -63,4 +60,4 @@ class MoveFileToExternalStorageAction
|
||||
// Delete file after upload
|
||||
$disk_local->delete("files/$user_id/$file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace Domain\Files\Actions;
|
||||
|
||||
use App\Users\Actions\CheckStorageCapacityAction;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
@@ -9,6 +8,7 @@ use Illuminate\Support\Facades\Storage;
|
||||
use Domain\Files\Requests\UploadRequest;
|
||||
use Domain\Files\Models\File as UserFile;
|
||||
use Domain\Traffic\Actions\RecordUploadAction;
|
||||
use App\Users\Actions\CheckStorageCapacityAction;
|
||||
|
||||
class UploadFileAction
|
||||
{
|
||||
@@ -17,7 +17,8 @@ class UploadFileAction
|
||||
public CheckStorageCapacityAction $checkStorageCapacity,
|
||||
public CreateImageThumbnailAction $createImageThumbnail,
|
||||
public MoveFileToExternalStorageAction $moveFileToExternalStorage,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload new file
|
||||
|
||||
Reference in New Issue
Block a user