Mar 22, 2019
0
Level 1
Looping through videos in laravel
I'm learning how to program in laravel and I'm trying to loop through youtube videos but is not displaying any videos. Please let me know how to fix this.
Here is my controller
public static function getLessonvideo($id) { $url = Lesson::where('id',$id)->value('video_link'); return LaravelVideoEmbed::parse($url); }
and here is my blade
@foreach($course->activeLessons as $lesson) {!! $loop->iteration!!}. {!! $lesson->title!!}
{!! $lesson->short_description !!}
<video
id="vid1"
class="video-js vjs-default-skin"
controls
autoplay
width="640" height="264"
data-setup='{ "techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "{{\App\Http\Controllers\EmployeeCoursesController::getLessonvideo($lesson->id)}}}] }'
>
</video>
</article>
@endforeach
Thanks so much
Please or to participate in this conversation.