Skip to content

Commit 968e85c

Browse files
committed
Improve
1 parent 4e6295f commit 968e85c

File tree

1 file changed

+19
-14
lines changed
  • resources/views/docs/mobile/2/the-basics

1 file changed

+19
-14
lines changed

resources/views/docs/mobile/2/the-basics/assets.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,27 @@ Note that the `storage_path()` helper points to a location _outside_ of your Lar
2727

2828
</aside>
2929

30-
## Pro tip!
30+
## Public files
3131

32-
Use the `asset()` helper method to access files in the public directory. Additionally, update your filesystems.php public url to the following:
32+
If your application receives files from the user — either generated by your application or imported from elsewhere,
33+
such as their photo gallery — you may wish to render these to the web view so they can be played or displayed as part
34+
of your app.
3335

34-
```php
35-
'public' => [
36-
'driver' => 'local',
37-
'root' => storage_path('app/public'),
38-
'url' => env('APP_URL').'/_assets/storage',
39-
'visibility' => 'public',
40-
'throw' => false,
41-
'report' => false,
42-
],
43-
```
36+
For this to work, they must be in the `public` directory. But you may also wish to persist these files across app
37+
updates. For this reason, they are stored outside of the `public` directory in a persistent storage location and this
38+
folder is symlinked to `public/storage`.
39+
40+
You can then access these files using the `mobile_public` disk:
4441

45-
Now you can use Laravel's Storage facade to display media in the webview, like so:
4642
```php
47-
Storage::disk('public')->url('/file.jpg)
43+
Storage::disk('mobile_public')->url('user_content.jpg');
4844
```
45+
46+
<aside>
47+
48+
#### Pro Tip!
49+
50+
Set `FILESYSTEM_DISK=mobile_public` in your `.env` when building your app so you can avoid having to explicitly change
51+
the disk on mobile.
52+
53+
</aside>

0 commit comments

Comments
 (0)