Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
a8f63696
Unverified
Commit
a8f63696
authored
Sep 21, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle local filesystem with public prefix
parent
e548ba18
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
CreateFolderOnDisk.php
Modules/Media/Events/Handlers/CreateFolderOnDisk.php
+10
-1
EloquentFolderRepositoryTest.php
Modules/Media/Tests/EloquentFolderRepositoryTest.php
+1
-1
MediaTestCase.php
Modules/Media/Tests/MediaTestCase.php
+1
-1
No files found.
Modules/Media/Events/Handlers/CreateFolderOnDisk.php
View file @
a8f63696
...
@@ -19,7 +19,16 @@ class CreateFolderOnDisk
...
@@ -19,7 +19,16 @@ class CreateFolderOnDisk
public
function
handle
(
FolderWasCreated
$event
)
public
function
handle
(
FolderWasCreated
$event
)
{
{
$this
->
filesystem
->
disk
(
$this
->
getConfiguredFilesystem
())
->
makeDirectory
(
$event
->
folder
->
path
->
getRelativeUrl
());
$this
->
filesystem
->
disk
(
$this
->
getConfiguredFilesystem
())
->
makeDirectory
(
$this
->
getDestinationPath
(
$event
->
folder
->
path
->
getRelativeUrl
()));
}
private
function
getDestinationPath
(
$path
)
{
if
(
$this
->
getConfiguredFilesystem
()
===
'local'
)
{
return
basename
(
public_path
())
.
$path
;
}
return
$path
;
}
}
/**
/**
...
...
Modules/Media/Tests/EloquentFolderRepositoryTest.php
View file @
a8f63696
...
@@ -35,7 +35,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase
...
@@ -35,7 +35,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase
/** @test */
/** @test */
public
function
it_can_create_a_folder_in_database
()
public
function
it_can_create_a_folder_in_database
()
{
{
$folder
=
$this
->
folder
->
create
([
'name'
=>
'My Folder'
]);
$folder
=
$this
->
folder
->
create
([
'name'
=>
'My Folder'
,
'parent_id'
=>
0
]);
$this
->
assertCount
(
1
,
$this
->
folder
->
all
());
$this
->
assertCount
(
1
,
$this
->
folder
->
all
());
$this
->
assertEquals
(
'My Folder'
,
$folder
->
filename
);
$this
->
assertEquals
(
'My Folder'
,
$folder
->
filename
);
...
...
Modules/Media/Tests/MediaTestCase.php
View file @
a8f63696
...
@@ -65,6 +65,6 @@ abstract class MediaTestCase extends TestCase
...
@@ -65,6 +65,6 @@ abstract class MediaTestCase extends TestCase
$app
[
'config'
]
->
set
(
'app.url'
,
'http://localhost'
);
$app
[
'config'
]
->
set
(
'app.url'
,
'http://localhost'
);
$app
[
'config'
]
->
set
(
'filesystems.disks.local.url'
,
'http://localhost'
);
$app
[
'config'
]
->
set
(
'filesystems.disks.local.url'
,
'http://localhost'
);
$app
[
'config'
]
->
set
(
'filesystems.disks.local.visibility'
,
'public'
);
$app
[
'config'
]
->
set
(
'filesystems.disks.local.visibility'
,
'public'
);
$app
[
'config'
]
->
set
(
'filesystems.disks.local.root'
,
public
_path
());
$app
[
'config'
]
->
set
(
'filesystems.disks.local.root'
,
base
_path
());
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment