public function createShipping() { if (Shipping::where('cart_id', Session::get('cart_id'))->pluck('payment_status') == 'Paid') { return Redirect::route('alreadyPaid'); } elseif (Shipping::where('cart_id', Session::get('cart_id'))->pluck('cart_id') > '') { $cart = Shipping::where('cart_id', Session::get('cart_id'))->first(); $cart->email = Input::get('email'); $cart->phone = Input::get('phone'); $cart->ship_f_name = Input::get('ship_f_name'); $cart->ship_l_name = Input::get('ship_l_name'); $cart->ship_address1 = Input::get('ship_address1'); $cart->ship_address2 = Input::get('ship_address2'); $cart->ship_city = Input::get('ship_city'); $cart->ship_state = Input::get('ship_state'); $cart->ship_zip = Input::get('ship_zip'); $cart->cart_amt = Session::get('checkoutAmt'); $cart->save(); return Redirect::route('makeCCPayment'); } else { $validator = Validator::make($data = Input::except('_token', 'password'), Shipping::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } Shipping::create($data); if (Input::get('password')) { if (Customer::where('email', Input::get('email'))->pluck('id') == Null) { Customer::create(array('username' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'email' => Input::get('email'))); } } return Redirect::route('makeCCPayment'); } }