VideoEmbedField
This field allows a user to paste in a URL for a video. It's ID and the type of video (e.g. youtube) will then be extracted and stored in a JSON column.
Accepted Video types
Currently we can accept videos from:
- Youtube
- Vimeo
Setup
- Create a JSON field
Add the field to
fillableon your model. E.g.:protected $fillable = [ 'my_video_embed_field' ];Add the field to
castson your model. E.g.:protected $casts = [ 'my_video_embed_field' => 'array', ];Add the field to your Crud:
VideoEmbedField::make('my_video_embed_field')),
Showing the videos on the frontend
Include the view from your own view. The specific sub-template for the video type will be included automatically.
@include('enso-fields::video-embed', [
'video' => $my_thing->my_video_embed_field
])
You can override these templates or create templates for custom video types (once that's implemented) by putting them in views/crud/video, e.g. views/crud/video/my-custom-video-type.blade.php.