/**
  * display all videos from a particular category
  * @param $id
  * @return \Illuminate\Http\Response
  */
 public function feedsByCategory($id)
 {
     $videos = Video::where('category_id', '=', $id)->get();
     $format = Carbon::now()->subMonth();
     $latest = $this->video->whereDateFormat('created_at', '>=', $format);
     return view('pages.categoryfeeds', compact('videos', 'latest'));
 }
 public function testVideoFind()
 {
     $user = factory(\Techademia\User::class)->create();
     $this->actingAs($user)->withSession(['username' => 'jeffrey']);
     factory(\Techademia\Category::class)->create();
     factory(\Techademia\Video::class)->create();
     $see_video = Video::find(1);
     $this->visit('/video/1/edit')->assertViewHas('video');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $v = Validator::make($request->all(), ['title' => 'required', 'description' => 'required', 'url' => 'required|url']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $data = $request->all();
     $data['user_id'] = Auth::user()->id;
     $data['category_id'] = 1;
     Video::create($data);
     return redirect()->back()->with('status', 'Your video was successfulyy uploaded!');
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $videos = Video::paginate(6);
     return view('welcome', compact('videos'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // dd(Auth::user()->id);
     $videos = Video::all();
     return view('pages.profile', compact('videos'));
 }
 /**
  * [create description]
  * @param  [type] $data [description]
  * @return [type]       [description]
  */
 public function create($data)
 {
     return Video::create($data);
 }