mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-20 00:42:16 +00:00
Guardian and FileManagerService.php refactored
This commit is contained in:
@@ -27,42 +27,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class FileManagerService
|
||||
{
|
||||
/**
|
||||
* Store folder icon
|
||||
*
|
||||
* @param $request
|
||||
* @param $id
|
||||
*/
|
||||
public static function set_folder_icon($request, $id)
|
||||
{
|
||||
// Get folder
|
||||
$folder = Folder::find($id);
|
||||
|
||||
// Set default folder icon
|
||||
if ($request->emoji === 'default') {
|
||||
$folder->update([
|
||||
'emoji' => null,
|
||||
'color' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
// Set emoji
|
||||
if ($request->filled('emoji')) {
|
||||
$folder->update([
|
||||
'emoji' => $request->emoji,
|
||||
'color' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
// Set color
|
||||
if ($request->filled('color')) {
|
||||
$folder->update([
|
||||
'emoji' => null,
|
||||
'color' => $request->color,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zip requested folder
|
||||
*
|
||||
@@ -480,6 +444,42 @@ class FileManagerService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store folder icon
|
||||
*
|
||||
* @param $request
|
||||
* @param $id
|
||||
*/
|
||||
public static function set_folder_icon($request, $id)
|
||||
{
|
||||
// Get folder
|
||||
$folder = Folder::find($id);
|
||||
|
||||
// Set default folder icon
|
||||
if ($request->emoji === 'default') {
|
||||
$folder->update([
|
||||
'emoji' => null,
|
||||
'color' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
// Set emoji
|
||||
if ($request->filled('emoji')) {
|
||||
$folder->update([
|
||||
'emoji' => $request->emoji,
|
||||
'color' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
// Set color
|
||||
if ($request->filled('color')) {
|
||||
$folder->update([
|
||||
'emoji' => null,
|
||||
'color' => $request->color,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move file to external storage if is set
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user