/**
  * Save a new category
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required']);
     $input = $request->all();
     $this->categoryRepository->create($input);
     return redirect()->route('pdp.categories')->with('success', 'Category added');
 }
 /**
  * Save a new domain
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'url' => 'required|url']);
     $input = $request->all();
     $domain = $this->domainRepository->create($input);
     $category = '';
     // if a new category has been assigned
     if ($request->input('new_category')) {
         $category = $this->categoryRepository->create(['name' => $request->input('new_category')]);
     } elseif ($request->input('category_id')) {
         $category = $this->categoryRepository->find($request->input('category_id'));
     }
     if ($category) {
         $domain->category()->associate($category);
         $domain->save();
     }
     return redirect()->route('pdp.home')->with('success', 'Domain added');
 }