public function addInfoVerify() { $user = Confide::user(); $userinfo = UserInformation::where('user_id', $user->id)->first(); if (!isset($userinfo->user_id)) { $userinfo = new UserInformation(); } $userinfo->user_id = $user->id; $userinfo->address_1 = Input::get('address_1'); $userinfo->address_2 = Input::get('address_2'); $userinfo->city = Input::get('city'); $userinfo->postal_code = Input::get('postal_code'); $userinfo->country = Input::get('country'); $userinfo->state = Input::get('state'); $userinfo->date_birth = date('Y-m-d', strtotime(Input::get('date_birth'))); $government_photo_1 = Input::file('government_photo_1'); $government_photo_2 = Input::file('government_photo_2'); $utility_bill = Input::file('utility_bill'); if (!empty($government_photo_1)) { $extension = $government_photo_1->getClientOriginalExtension(); $destinationPath = 'upload/images/'; $fileName = time() . '.' . $extension; if (in_array($extension, array('jpg', 'png'))) { if ($government_photo_1->move($destinationPath, $fileName)) { $userinfo->government_photo_1 = $destinationPath . $fileName; } } else { return Redirect::to('user/profile/verify')->with('error', Lang::get('messages.extension_invalid')); } } if (!empty($government_photo_2)) { $extension = $government_photo_2->getClientOriginalExtension(); $destinationPath = 'upload/images/'; $fileName = time() . '.' . $extension; if (in_array($extension, array('jpg', 'png'))) { if ($government_photo_2->move($destinationPath, $fileName)) { $userinfo->government_photo_2 = $destinationPath . $fileName; } } else { return Redirect::to('user/profile/verify')->with('error', Lang::get('messages.extension_invalid')); } } if (!empty($utility_bill)) { $extension = $utility_bill->getClientOriginalExtension(); $destinationPath = 'upload/images/'; $fileName = time() . '.' . $extension; if (in_array($extension, array('jpg', 'png', 'pdf'))) { if ($utility_bill->move($destinationPath, $fileName)) { $userinfo->utility_bill = $destinationPath . $fileName; } } else { return Redirect::to('user/profile/verify')->with('error', Lang::get('messages.extension_invalid')); } } $userinfo->save(); return Redirect::to('user/profile/verify')->with('notice', Lang::get('messages.update_success')); }