File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
src/Illuminate/Filesystem Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,13 @@ public function createScopedDriver(array $config)
285
285
286
286
return $ this ->build (tap (
287
287
is_string ($ config ['disk ' ]) ? $ this ->getConfig ($ config ['disk ' ]) : $ config ['disk ' ],
288
- fn (&$ parent ) => $ parent ['prefix ' ] = $ config ['prefix ' ]
288
+ function (&$ parent ) use ($ config ) {
289
+ $ parent ['prefix ' ] = $ config ['prefix ' ];
290
+
291
+ if (isset ($ config ['visibility ' ])) {
292
+ $ parent ['visibility ' ] = $ config ['visibility ' ];
293
+ }
294
+ }
289
295
));
290
296
}
291
297
Original file line number Diff line number Diff line change @@ -98,6 +98,40 @@ public function testCanBuildScopedDisks()
98
98
}
99
99
}
100
100
101
+ /**
102
+ * @requires OS Linux|Darwin
103
+ */
104
+ public function testCanBuildScopedDisksWithVisibility ()
105
+ {
106
+ try {
107
+ $ filesystem = new FilesystemManager (tap (new Application , function ($ app ) {
108
+ $ app ['config ' ] = [
109
+ 'filesystems.disks.local ' => [
110
+ 'driver ' => 'local ' ,
111
+ 'root ' => 'to-be-scoped ' ,
112
+ 'visibility ' => 'public ' ,
113
+ ],
114
+ ];
115
+ }));
116
+
117
+ $ scoped = $ filesystem ->build ([
118
+ 'driver ' => 'scoped ' ,
119
+ 'disk ' => 'local ' ,
120
+ 'prefix ' => 'path-prefix ' ,
121
+ 'visibility ' => 'private ' ,
122
+ ]);
123
+
124
+ $ scoped ->put ('dirname/filename.txt ' , 'file content ' );
125
+
126
+ $ this ->assertEquals ('private ' , $ scoped ->getVisibility ('dirname/filename.txt ' ));
127
+ } finally {
128
+ unlink (__DIR__ .'/../../to-be-scoped/path-prefix/dirname/filename.txt ' );
129
+ rmdir (__DIR__ .'/../../to-be-scoped/path-prefix/dirname ' );
130
+ rmdir (__DIR__ .'/../../to-be-scoped/path-prefix ' );
131
+ rmdir (__DIR__ .'/../../to-be-scoped ' );
132
+ }
133
+ }
134
+
101
135
public function testCanBuildInlineScopedDisks ()
102
136
{
103
137
try {
You can’t perform that action at this time.
0 commit comments