mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-25 02:10:39 +00:00
Refactoring
This commit is contained in:
@@ -86,9 +86,9 @@ class UploadFileAction
|
||||
return UserFile::create([
|
||||
'mimetype' => get_file_type_from_mimetype($file_mimetype),
|
||||
'type' => get_file_type($file_mimetype),
|
||||
'folder_id' => $request->folder_id,
|
||||
'folder_id' => $request->input('folder_id'),
|
||||
'metadata' => $metadata,
|
||||
'name' => $request->filename,
|
||||
'name' => $request->input('filename'),
|
||||
'basename' => $disk_file_name,
|
||||
'author' => $shared ? 'visitor' : 'user',
|
||||
'thumbnail' => $thumbnail,
|
||||
|
||||
@@ -9,18 +9,22 @@ use Support\Demo\Actions\FakeUploadFileAction;
|
||||
|
||||
class UploadFileController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
public UploadFileAction $uploadFiles,
|
||||
public FakeUploadFileAction $fakeUploadFile,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Upload file for authenticated master|editor user
|
||||
*/
|
||||
public function __invoke(
|
||||
UploadRequest $request,
|
||||
UploadFileAction $uploadFiles,
|
||||
FakeUploadFileAction $fakeUploadFile,
|
||||
): File | array {
|
||||
|
||||
if (is_demo_account('howdy@hi5ve.digital')) {
|
||||
return ($fakeUploadFile)($request);
|
||||
return ($this->fakeUploadFile)($request);
|
||||
}
|
||||
|
||||
return ($uploadFiles)($request);
|
||||
return ($this->uploadFiles)($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class VisitorUploadFileController extends Controller
|
||||
}
|
||||
|
||||
// Check access to requested directory
|
||||
($this->verifyAccessToItem)($request->folder_id, $shared);
|
||||
($this->verifyAccessToItem)($request->input('folder_id'), $shared);
|
||||
|
||||
// Return new uploaded file
|
||||
$new_file = ($this->uploadFile)($request, $shared);
|
||||
|
||||
@@ -19,8 +19,23 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
/**
|
||||
* @method static whereUserId($user_id)
|
||||
* @method static whereId($id)
|
||||
* @property string folder_id
|
||||
* @method static find(mixed $id)
|
||||
* @method static where(string $string, string $user_id)
|
||||
* @property string id
|
||||
* @property string user_id
|
||||
* @property string folder_id
|
||||
* @property string thumbnail
|
||||
* @property string filesize
|
||||
* @property string type
|
||||
* @property array metadata
|
||||
* @property string basename
|
||||
* @property string name
|
||||
* @property string mimetype
|
||||
* @property string author
|
||||
* @property string author_id
|
||||
* @property string created_at
|
||||
* @property string updated_at
|
||||
* @property string deleted_at
|
||||
*/
|
||||
class File extends Model
|
||||
{
|
||||
@@ -47,7 +62,7 @@ class File extends Model
|
||||
'author_id',
|
||||
];
|
||||
|
||||
public $sortable = [
|
||||
public array $sortable = [
|
||||
'name',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user