/**
  * @param $id
  * @param CategoriesRepository $repo
  * @return \Illuminate\View\View
  */
 public function categories($id, CategoriesRepository $repo)
 {
     $videos = DB::table('videos')->where('category_id', $id)->get();
     $categories = Category::all();
     $user = Auth::user();
     return view('welcome', compact('videos', 'categories', 'user', 'repo'));
 }
Exemplo n.º 2
0
 /**
  * @param UserRepository $repo
  * @return \Illuminate\View\View
  */
 public function index(UserRepository $repo)
 {
     $user = Auth::user();
     //get all categories
     $categories = Category::all();
     return view('users.dashboard', compact('repo', 'user', 'categories'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $user = Auth::user();
     $categories = Category::all();
     $video = Video::find($id);
     return view('videos.show', compact('user', 'video', 'categories'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $category = Category::find($id);
     $category->name = $request->get('name');
     $category->save();
 }
Exemplo n.º 5
0
 private function createCategory()
 {
     Category::create(['name' => 'Ruby']);
 }
 /**
  * @param $categoryId
  * @return mixed
  */
 public function findNewVideos($categoryId)
 {
     $category = Category::find($categoryId);
     return $this->getRecentVideos($category);
 }
 public function create(CategoriesRepository $repo)
 {
     $user = Auth::user();
     $categories = Category::all();
     return view('videos.new', compact('user', 'categories', 'repo'));
 }