Skip to content

Commit 3c3a6c2

Browse files
committed
Add docs
1 parent 4c787b5 commit 3c3a6c2

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

docs/guide/sharp-uploads.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,26 @@ $this->addField(
336336
```
337337

338338
In this code, the `legend` designates a custom attribute.
339+
340+
## Preview audio or video upload
341+
342+
If the field allows to upload an audio or video file, you can display a preview of it by specifying the `withPlayablePreview` option:
343+
344+
```php
345+
class MyForm extends SharpForm
346+
{
347+
// ...
348+
function find($id): array
349+
{
350+
return $this
351+
->setCustomTransformer(
352+
'video',
353+
new SharpUploadModelFormAttributeTransformer(withPlayablePreview: true)
354+
)
355+
->transform(Book::with('video')->findOrFail($id));
356+
}
357+
```
358+
359+
::: warning
360+
This feature is using Laravel's file [Temporary URL](https://laravel.com/docs/12.x/filesystem#temporary-urls) feature which only supports S3 & local driver.
361+
:::

0 commit comments

Comments
 (0)