public function brandRegister() { $obj = new helpers(); if ($obj->checkUserLogin()) { return redirect('home'); } $country = DB::table('countries')->orderBy('name', 'ASC')->get(); $alldata = array(); foreach ($country as $key => $value) { $alldata[$value->country_id] = $value->name; } //echo "<pre>";print_r($alldata); exit; $reg_brand_id = ''; // No register brand id for first time. if (Request::isMethod('post')) { $country = DB::table('countries')->where('country_id', '=', Request::input('card_country_id'))->first(); $shipping_card_addr = array('card_holder_fname' => Request::input('card_holder_fname'), 'card_holder_lname' => Request::input('card_holder_lname'), 'company_name' => Request::input('company_name'), 'expiry_month' => Request::input('expiry_month'), 'expiry_year' => Request::input('expiry_year'), 'cvv' => Request::input('cvv'), 'card_shiping_name' => Request::input('card_shiping_name'), 'card_shiping_address' => Request::input('card_shiping_address'), 'card_country_id' => Request::input('card_country_id'), 'card_shiping_city' => Request::input('card_shiping_city'), 'card_shipping_phone_no' => Request::input('card_shipping_phone_no'), 'card_shipping_fax' => Request::input('card_shipping_fax'), 'card_state' => Request::input('card_state'), 'card_shipping_postcode' => Request::input('card_shipping_postcode'), 'email' => Request::input('email'), 'card_number' => Request::input('card_number'), 'country' => $country->name); $res = Authorizenet::createprofile($shipping_card_addr); // echo $res['status']; // echo $res['customer']['payment_profile_id']; //print_r($res);exit; if ($res['status'] == 'fail') { Session::flash('error', 'something went wrong with creditcard details!!' . $res[message] . ' Please try again.'); return redirect('brandregister'); } //echo $_FILES['image']['name']."<pre>";print_r($_FILES);exit; //if(Input::hasFile('government_issue')) if ($_FILES['government_issue']['name'] != "") { $destinationPath = 'uploads/brand_government_issue_id/'; // upload path $extension = Input::file('government_issue')->getClientOriginalExtension(); // getting image extension $government_issue = rand(111111111, 999999999) . '.' . $extension; // renameing image Input::file('government_issue')->move($destinationPath, $government_issue); // uploading file to given path } else { $government_issue = ''; } //if(Input::hasFile('image')) if ($_FILES['image']['name'] != "") { $destinationPath = 'uploads/brandmember/'; // upload path $thumb_path = 'uploads/brandmember/thumb/'; $medium = 'uploads/brandmember/thumb/'; $extension = Input::file('image')->getClientOriginalExtension(); // getting image extension $fileName = rand(111111111, 999999999) . '.' . $extension; // renameing image Input::file('image')->move($destinationPath, $fileName); // uploading file to given path $obj->createThumbnail($fileName, 661, 440, $destinationPath, $thumb_path); $obj->createThumbnail($fileName, 116, 116, $destinationPath, $medium); } else { $fileName = ''; } $slug = $obj->create_slug(Request::input('fname') . " " . Request::input('lname'), 'brandmembers', 'slug'); $hashpassword = Hash::make(Request::input('password')); $address = new Address(); $time = Request::input('calltime'); $date = Request::input('calldate'); $given_date = strtotime($date . " " . $time); $given_date = date("Y-m-d H:s:i", $given_date); $brandmember = Brandmember::create(['fname' => Request::input('fname'), 'lname' => Request::input('lname'), 'email' => Request::input('email'), 'username' => strtolower(Request::input('fname')), 'password' => $hashpassword, 'government_issue' => $government_issue, 'phone_no' => Request::input('phone_no'), 'routing_number' => Request::input('routing_number'), 'account_number' => Request::input('account_number'), 'mailing_name' => Request::input('mailing_name'), 'mailing_address' => Request::input('mailing_address'), 'mailing_country_id' => Request::input('mailing_country_id'), 'mailing_city' => Request::input('mailing_city'), 'mailing_lastname' => Request::input('mailing_lastname'), 'mailing_address2' => Request::input('mailing_address2'), 'mailing_state' => Request::input('mailing_state'), 'mailing_postcode' => Request::input('mailing_postcode'), 'call_datetime' => $given_date, 'paypal_email' => Request::input('paypal_email'), 'mailing_address' => Request::input('mailing_address'), 'default_band_preference' => Request::input('default_band_preference'), 'pro_image' => $fileName, 'role' => 1, 'admin_status' => 0, 'auth_profile_id' => $res['customer']['profile_id'], 'auth_payment_profile_id' => $res['customer']['payment_profile_id'], 'auth_address_id' => $res['customer']['address_id'], 'slug' => $slug]); $shipping_card_addr = array('card_holder_name' => Request::input('card_holder_name'), 'card_number' => Request::input('card_number'), 'card_name' => Request::input('card_name'), 'expiry_month' => Request::input('expiry_month'), 'expiry_year' => Request::input('expiry_year'), 'card_shiping_name' => Request::input('card_shiping_name'), 'card_shiping_address' => Request::input('card_shiping_address'), 'card_country_id' => Request::input('card_country_id'), 'card_shiping_city' => Request::input('card_shiping_city'), 'card_shipping_phone_no' => Request::input('card_shipping_phone_no'), 'card_shipping_address2' => Request::input('card_shipping_address2'), 'card_state' => Request::input('card_state'), 'card_shipping_postcode' => Request::input('card_shipping_postcode')); $shipping_card_addr_serial = serialize($shipping_card_addr); $lastInsertedId = $brandmember->id; $reg_brand_id = $lastInsertedId; //base64_encode ($lastInsertedId); // encrypted last register brand member id $address->mem_brand_id = $lastInsertedId; $address->first_name = Request::input('shiping_fname'); $address->last_name = Request::input('shiping_lname'); $address->address = Request::input('shiping_address'); $address->address2 = Request::input('shipping_address2'); $address->country_id = Request::input('country'); $address->zone_id = Request::input('state'); // State id $address->city = Request::input('city'); $address->postcode = Request::input('shipping_postcode'); $address->serialize_val = ''; if ($address->save()) { $addressId = $address->id; $dataUpdateAddress = DB::table('brandmembers')->where('id', $lastInsertedId)->update(['address' => $addressId]); $sitesettings = DB::table('sitesettings')->get(); //exit; if (!empty($sitesettings)) { foreach ($sitesettings as $each_sitesetting) { if ($each_sitesetting->name == 'email') { $admin_users_email = $each_sitesetting->value; } } } //Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.'); //return redirect('brandregister'); $user_name = Request::input('fname') . ' ' . Request::input('lname'); $user_email = Request::input('email'); $activateLink = url() . '/activateLink/' . base64_encode(Request::input('email')) . '/brand'; $sent = Mail::send('frontend.register.activateLink', array('name' => $user_name, 'email' => $user_email, 'activate_link' => $activateLink), function ($message) use($admin_users_email, $user_email, $user_name) { $message->from($admin_users_email); $message->to($user_email, $user_name)->subject('Activate Profile Mail'); }); if (!$sent) { Session::flash('error', 'something went wrong!! Mail not sent.'); return redirect('brandregister'); } else { Session::flash('success', 'Registration completed successfully.Please check your email to activate your account.'); Session::flash('flush_reg_brand_id', 'open_modal'); Session::put('reg_brand_id', $reg_brand_id); return redirect('brandregister'); } } } return view('frontend.register.registerbrand', compact('alldata'), array('reg_brand_id' => $reg_brand_id)); }
public function brand_forgotPassword() { $obj = new helpers(); if ($obj->checkUserLogin()) { return redirect('brand-dashboard'); } if (Request::isMethod('post')) { $email = Request::input('email'); $brandmembers = DB::table('brandmembers')->where('email', '=', $email)->where('role', '=', 1)->first(); $random_code = mt_rand(); $updateWithCode = DB::table('brandmembers')->where('email', '=', $email)->update(array('code_number' => $random_code)); $sitesettings = DB::table('sitesettings')->get(); //exit; if (!empty($sitesettings)) { foreach ($sitesettings as $each_sitesetting) { if ($each_sitesetting->name == 'email') { $admin_users_email = $each_sitesetting->value; } } } if (!empty($brandmembers)) { $user_name = $brandmembers->fname . ' ' . $brandmembers->lname; $user_email = $brandmembers->email; $resetpassword_link = url() . '/brand-reset-password/' . base64_encode($user_email) . '-' . base64_encode($random_code); //echo $resetpassword_link; exit; $sent = Mail::send('frontend.home.reset_password_link', array('name' => $user_name, 'email' => $user_email, 'reset_password_link' => $resetpassword_link), function ($message) use($admin_users_email, $user_email, $user_name) { $message->from($admin_users_email); $message->to($user_email, $user_name)->subject('Forgot Password Email!'); }); if (!$sent) { Session::flash('error', 'something went wrong!! Mail not sent.'); return redirect('brand-forgot-password'); } else { Session::flash('success', 'Please check your email to reset your password.'); return redirect('brandLogin'); } } else { Session::flash('error', 'Email Id not matched.'); return redirect('brand-forgot-password'); } } return view('frontend.home.brandforgotpassword'); }