/**
  * Post the register form
  *
  *@return redirect
  */
 function postRegister()
 {
     $rules = array('email' => 'required|email|unique:vendors', 'password' => 'required|min:2');
     $email = Input::get('email');
     $password = Input::get('password');
     $validator = Validator::make(['email' => $email, 'password' => $password], $rules);
     $vendorType = Input::get('type');
     $vendorData = array('email' => $email, 'password' => sha1($password), 'manufacturer' => $vendorType);
     if ($validator->passes()) {
         $id = RegisterModel::addVendor($vendorData);
         $profileData = array('id' => $id, 'email' => $email, 'password' => sha1($password), 'vendor_type' => $vendorType, 'verified' => 0);
         RegisterModel::addProfile($profileData);
         Session::put('vendor_id', $id);
         mkdir(base_path() . '/uploads/vendors/' . $id, 0700);
         mkdir(base_path() . '/uploads/products/' . $id, 0700);
         mkdir(base_path() . '/uploads/csvs/' . $id, 0700);
         return Redirect::to('/profile/');
     }
     return Redirect::to('/')->with('e_msg', 'Something went wrong with the registration!')->withErrors($validator)->withInput();
 }