mirror of
https://github.com/brufdev/many-notes.git
synced 2026-05-20 17:28:38 -05:00
Refactor code
This commit is contained in:
@@ -12,9 +12,7 @@ final readonly class UpdateVaultNode
|
||||
/**
|
||||
* @param array{
|
||||
* parent_id?: int|null,
|
||||
* is_file?: bool,
|
||||
* name?: string,
|
||||
* extension?: string|null,
|
||||
* content?: string|null
|
||||
* } $attributes
|
||||
*/
|
||||
@@ -31,13 +29,7 @@ final readonly class UpdateVaultNode
|
||||
}
|
||||
|
||||
// Rename node on disk
|
||||
if ($node->wasChanged('name')) {
|
||||
$path = new GetPathFromVaultNode()->handle($node);
|
||||
Storage::disk('local')->move($originalPath, $path);
|
||||
}
|
||||
|
||||
// Move node on disk
|
||||
if ($node->wasChanged('parent_id')) {
|
||||
if ($node->wasChanged(['name', 'parent_id'])) {
|
||||
$path = new GetPathFromVaultNode()->handle($node);
|
||||
Storage::disk('local')->move($originalPath, $path);
|
||||
}
|
||||
|
||||
@@ -99,9 +99,7 @@ final class VaultNodeForm extends Form
|
||||
|
||||
new UpdateVaultNode()->handle($this->node, [
|
||||
'parent_id' => $this->parent_id,
|
||||
'is_file' => (bool) $this->node->is_file,
|
||||
'name' => $this->name,
|
||||
'extension' => $this->node->extension,
|
||||
'content' => $this->content,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user