I am working on Laravel 5.2. I have to display a video on my view page.I am able to store the video in my database table but, not able to fetch it and display it.I have the column in my table having the filepath of the videos which i am using to fetch it from the database. My table is like dis:
My Controller:
public function talent(Request $request){
$user=new Talent();
$this->validate($request, [
'video'=>'required',
]);
$video=$request->file('video');
$filename=time().'.'. $video->getClientOriginalExtension();
$pathVideo = public_path('uploads/video/' . $filename);
Input::file('video')->move('uploads/video/', $pathVideo);
$user->file_path=$pathVideo;
$user->video=$filename;
$user->user_id=Auth::user()->id;
$user->save();
return redirect()->back();
}
public function talentpool($id){
$user=User::findorFail($id);
$talents=Talent::orderBy('created_at','desc')->get();
return view('talentpool',['user'=>$user,'talents'=>$talents]);
}
My View:
@foreach($talents as $talent)
<video width="616" src="{{ $talent->file_path }}" controls></video>
@endforeach