Match folder path with media prefix

parent 75ad490c
...@@ -11,7 +11,7 @@ class EloquentFolderRepository extends EloquentBaseRepository implements FolderR ...@@ -11,7 +11,7 @@ class EloquentFolderRepository extends EloquentBaseRepository implements FolderR
{ {
return $this->model->create([ return $this->model->create([
'filename' => array_get($data, 'name'), 'filename' => array_get($data, 'name'),
'path' => str_slug(array_get($data, 'name')), 'path' => config('asgard.media.config.files-path') . str_slug(array_get($data, 'name')),
'is_folder' => true, 'is_folder' => true,
'folder_id' => array_get($data, 'parent_id'), 'folder_id' => array_get($data, 'parent_id'),
]); ]);
......
...@@ -20,6 +20,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase ...@@ -20,6 +20,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase
$this->resetDatabase(); $this->resetDatabase();
$this->folder = app(FolderRepository::class); $this->folder = app(FolderRepository::class);
$this->app['config']->set('asgard.media.config.files-path', '/assets/media/');
} }
/** @test */ /** @test */
...@@ -29,7 +30,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase ...@@ -29,7 +30,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase
$this->assertCount(1, $this->folder->all()); $this->assertCount(1, $this->folder->all());
$this->assertEquals('My Folder', $folder->filename); $this->assertEquals('My Folder', $folder->filename);
$this->assertEquals('my-folder', $folder->path->getRelativeUrl()); $this->assertEquals('/assets/media/my-folder', $folder->path->getRelativeUrl());
$this->assertTrue( $folder->is_folder); $this->assertTrue( $folder->is_folder);
} }
......
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