/**
  * post process for register product
  * @param Request $request
  * @return $this
  */
 public function createProduct(RegisterProductRequest $request)
 {
     $response = $this->dispatch(new RegisterProductJob($request->get('code'), $request->user()));
     if (!$response) {
         return redirect()->back()->withErrors(['error' => 'Code has been taken (OR) not valid']);
     }
     return redirect()->route('web.index')->withSucess('Product registered successfully');
 }
 /**
  * @param RegisterProductRequest $request
  * @param User $user
  * @return $this
  */
 public function registerCode(RegisterProductRequest $request, User $user)
 {
     $response = $this->dispatch(new RegisterProductJob($request->get('code'), $user));
     if (!$response) {
         return redirect()->back()->withErrors(['error' => 'Code has been taken (OR) not valid']);
     }
     return redirect()->route('user.codes', $user->id)->withSucess('Product registered successfully');
 }