Video Embed

Added v0.2.16
Column Type json

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 fillable on your model. E.g.:

    protected $fillable = [
      'my_video_embed_field'
    ];
    
  • Add the field to casts on your model. E.g.:

    protected $casts = [
      'my_video_embed_field' => 'array',
    ];
    
  • Add the field to your Crud:

    (new VideoEmbedField('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.