/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Category::create(['title' => 'Programming', 'description' => 'This is the description for this category', 'slug' => 'programming']);
     Category::create(['title' => 'DevOps', 'description' => 'This is the description for this category', 'slug' => 'devops']);
     Category::create(['title' => 'Design Patterns', 'description' => 'This is the description for this category', 'slug' => 'design-patterns']);
     Category::create(['title' => 'Game Development', 'description' => 'This is the description for this category', 'slug' => 'game-development']);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required']);
     $data = $request->all();
     Category::create($data);
     return redirect()->back()->with('status', 'success!');
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $format = Carbon::now()->subMonth();
     $videos = $this->video->where('user_id', Auth::user()->id);
     $categories = Category::all();
     $latest = $this->video->whereDateFormat('created_at', '>=', $format);
     return view('pages.profile', compact('videos', 'latest'))->with('categories', $categories);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $video = $this->video->find($id);
     $categories = Category::all();
     return view('pages.editvideo')->with('video', $video)->with('categories', $categories);
 }
 public function testSeeInDatabase()
 {
     Category::create(['title' => 'robotics']);
     $this->seeInDatabase('categories', ['title' => 'robotics']);
 }