File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,12 @@ class Channel extends Model implements InteractWithMedia
249
249
250
250
### Adding Media
251
251
252
- Add media to your model from various sources:
252
+ Add media to your model, using the ` addMedia ` method, from various sources:
253
+
254
+ - an url
255
+ - a resource or stream
256
+ - a \Illuminate\Http\UploadedFile instance
257
+ - a \Illuminate\Http\File instance
253
258
254
259
#### From a Controller
255
260
@@ -267,7 +272,6 @@ public function store(Request $request, Channel $channel)
267
272
} catch (InvalidMimeTypeException $exception){
268
273
// Will throw an error if the mime type is not included in the collection's `acceptedMimeTypes` parameter.
269
274
}
270
-
271
275
}
272
276
```
273
277
@@ -300,6 +304,22 @@ class ImageUploader extends Component
300
304
}
301
305
```
302
306
307
+ #### From an Url
308
+
309
+ ``` php
310
+ use Elegantly\Media\Exceptions\InvalidMimeTypeException;
311
+
312
+ try {
313
+ $channel->addMedia(
314
+ file: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
315
+ collectionName: 'videos',
316
+ name: "BigBuckBunny"
317
+ );
318
+ } catch (InvalidMimeTypeException $exception){
319
+ // Will throw an error if the mime type is not included in the collection's `acceptedMimeTypes` parameter.
320
+ }
321
+ ```
322
+
303
323
### Retreiving Media
304
324
305
325
Retrieve media from your model:
You can’t perform that action at this time.
0 commit comments