Setting the new folder_id when moving

parent 3b7f3d37
...@@ -204,6 +204,7 @@ class EloquentFileRepository extends EloquentBaseRepository implements FileRepos ...@@ -204,6 +204,7 @@ class EloquentFileRepository extends EloquentBaseRepository implements FileRepos
$this->update($file, [ $this->update($file, [
'path' => $this->getPathFor($file->filename, $destination->id), 'path' => $this->getPathFor($file->filename, $destination->id),
'folder_id' => $destination->id,
]); ]);
event(new FileStartedMoving($file, $previousData)); event(new FileStartedMoving($file, $previousData));
......
...@@ -270,6 +270,7 @@ class EloquentFileRepositoryTest extends MediaTestCase ...@@ -270,6 +270,7 @@ class EloquentFileRepositoryTest extends MediaTestCase
$file = $this->file->move($file, $folder); $file = $this->file->move($file, $folder);
$this->assertEquals('my-file.pdf', $file->filename); $this->assertEquals('my-file.pdf', $file->filename);
$this->assertEquals($file->folder_id, $folder->id);
$this->assertEquals('/assets/media/my-folder/child-folder/my-file.pdf', $file->path->getRelativeUrl()); $this->assertEquals('/assets/media/my-folder/child-folder/my-file.pdf', $file->path->getRelativeUrl());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment