public function mobilegooglelogin() { $inpudetails = Input::except(array('link')); $inpudetails['google_id'] = Input::get('id'); $emailid = Input::get('email'); $curdate = date('Y-m-d h:i:s'); $inpudetails['createddate'] = $curdate; //return $inpudetails; //$inpudetails['status']= 1; $validator = Validator::make($inpudetails, ProfileModel::$socialrules); if ($validator->passes()) { $verifyuser = ProfileModel::where('email', $emailid)->get()->count(); $userid = ProfileModel::select('ID', 'status', 'firstname', 'lastname', 'username')->where('email', $emailid)->get(); if ($verifyuser) { if ($userid[0]['status'] == 1) { $userid1 = $userid[0]['ID']; $updatedata['google_id'] = Input::get('id'); $updatedata['gcm_id'] = Input::get('gcm_id'); $updatedata['device_id'] = Input::get('device_id'); $updatedata['device_type'] = Input::get('device_type'); $userregister = ProfileModel::where('ID', $userid1)->update($updatedata); if ($userid[0]['firstname'] != '') { $name = $userid[0]['firstname'] . ' ' . $userid[0]['lastname']; } else { $name = $userid[0]['username']; } $Response = array('success' => '1', 'message' => 'successfully Login', 'userid' => $userid1, 'name' => $name, 'msgcode' => "c102"); $final = array("response" => $Response); return json_encode($final); } else { $admindetails = User::select('email')->where('ID', 1)->first(); $Response = array('success' => '0', 'message' => "Your account is inactive please contact admin (" . $admindetails->email . ")", 'mailid' => $admindetails->email, 'msgcode' => "c196"); $final = array("response" => $Response); return json_encode($final); } } else { $inpudetails['google_id'] = Input::get('id'); $inpudetails['status'] = '1'; $inpudetails['gcm_id'] = Input::get('gcm_id'); $inpudetails['device_id'] = Input::get('device_id'); $inpudetails['device_type'] = Input::get('device_type'); $inpudetails['timezone'] = Input::get('timezone'); $saved = ProfileModel::create($inpudetails); if ($saved) { $userid = ProfileModel::max('ID'); $Response = array('success' => '1', 'message' => 'successfully created Login', 'userid' => $userid, 'msgcode' => "c156"); $final = array("response" => $Response); return json_encode($final); } } } else { $Response = array('success' => '0', 'message' => 'Some Fields are Missing', 'msgcode' => "c101"); $final = array("response" => $Response); return json_encode($final); } }
public function mobilegooglelogin() { $inpudetails = Input::except(array('link')); $inpudetails['google_id'] = Input::get('id'); $emailid = Input::get('email'); $curdate = date('Y-m-d h:i:s'); $inpudetails['createddate'] = $curdate; //return $inpudetails; $validator = Validator::make($inpudetails, ProfileModel::$socialrules); if ($validator->passes()) { $verifyuser = ProfileModel::where('email', $emailid)->get()->count(); $userid = ProfileModel::select('ID')->where('email', $emailid)->get(); if ($verifyuser) { $userid1 = $userid[0]['ID']; $updatedata['google_id'] = Input::get('id'); $updatedata['gcm_id'] = Input::get('gcm_id'); $updatedata['device_id'] = Input::get('device_id'); $updatedata['device_type'] = Input::get('device_type'); $userregister = ProfileModel::where('ID', $userid1)->update($updatedata); $Response = array('success' => '1', 'message' => 'successfully Login', 'userid' => $userid1); $final = array("response" => $Response); return json_encode($final); } else { $inpudetails['google_id'] = Input::get('id'); $inpudetails['status'] = 'A'; $inpudetails['gcm_id'] = Input::get('gcm_id'); $inpudetails['device_id'] = Input::get('device_id'); $inpudetails['device_type'] = Input::get('device_type'); $inpudetails['timezone'] = Input::get('timezone'); $saved = ProfileModel::create($inpudetails); if ($saved) { $userid = ProfileModel::max('ID'); $Response = array('success' => '1', 'message' => 'successfully created Login', 'userid' => $userid); $final = array("response" => $Response); return json_encode($final); } } } else { $Response = array('success' => '0', 'message' => 'Some Fields are Missing'); $final = array("response" => $Response); return json_encode($final); } }