public function doRegister(Request $request) { $validator = Validator::make($data = $request->all(), Candidate::$rules, Candidate::$messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } if ($validator->passes()) { //$confirmation_code = Str::quickRandom(30); $confirmation_code = '12345'; $candidate = new Candidate(); //$candidate->name = ucwords($request->fullname); $candidate->username = $request->username; $candidate->mobile_no = $request->mobile_no; $candidate->email = $request->email; $candidate->password = bcrypt($request->password); $candidate->confirmation_code = $confirmation_code; $data = ['confirmation_code' => $confirmation_code, 'username' => $request->username, 'password' => $request->password, 'mobile_no' => $request->mobile_no]; Basehelper::sendSMS($request->mobile_no, 'Hello ' . $request->username . ', you have successfully registere. Your username is ' . $request->username . ' and password is ' . $request->password); // Mail::send('emails.verify', $data, function($message) use ($candidate, $data){ // $message->from('no-reply@employment_bank', 'Employment Bank'); // $message->to(Input::get('email'), $candidate->name) // ->subject('Verify your email address'); // }); if (!$candidate->save()) { return Redirect::back()->with('message', 'Error while creating your account!<br> Please contact Technical Support'); } return Redirect::route('candidate.login')->with('message', 'Account has been created!<br>Now Check your email address to verify your account by checking your spam folder or inboxes for verification link after that you can login'); //sendConfirmation() Will go the email and sms as needed } else { return Redirect::back()->withInput()->withErrors($validation); } }
public function viewCandidateProfile($candidate_id) { //Hashids::getDefaultConnection(); $decoded = Hashids::decode($candidate_id); //return count($decoded); //code for displaying full profle with bio, educations detals, experience details and so $candidate = Candidate::find($decoded)->first(); //return $candidate; $info = CandidateInfo::where('candidate_id', $decoded)->first(); //$edu = CandidateEduDetails::where('candidate_id', $decoded)->get(); $edu = CandidateEduDetails::where('candidate_id', $decoded)->join('master_exams', 'candidate_edu_details.exam_id', '=', 'master_exams.id')->join('master_boards', 'candidate_edu_details.board_id', '=', 'master_boards.id')->join('master_subjects', 'candidate_edu_details.subject_id', '=', 'master_subjects.id')->select('master_exams.name as exam_name', 'master_exams.exam_category', 'candidate_edu_details.specialization', 'candidate_edu_details.pass_year', 'candidate_edu_details.percentage', 'master_boards.name as board_name', 'master_subjects.name as subject_name')->get(); //::join('candidates', 'candidate_infos.candidate_id', '=', 'candidates.id') $lang = CandidateLanguageInfo::where('candidate_id', $decoded)->get(); $exp = CandidateExpDetails::where('candidate_id', $decoded)->join('master_industry_types', 'candidate_experience_details.industry_id', '=', 'master_industry_types.id')->join('master_subjects', 'candidate_experience_details.experience_id', '=', 'master_subjects.id')->select('master_subjects.name as exp_type', 'master_industry_types.name as sector', 'candidate_experience_details.post_held', 'candidate_experience_details.year_experience', 'candidate_experience_details.salary', 'candidate_experience_details.employers_name')->orderBy('candidate_experience_details.id', 'DESC')->get(); return view('admin.applications.profile', compact('candidate', 'info', 'edu', 'lang', 'exp')); }
public function doActivate(Request $request) { $messages = ['username.exists' => 'Username Does not exists in our System']; $validator = Validator::make($data = $request->all(), ['username' => 'exists:candidates,username'], $messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $candidate = Candidate::where('username', $request->username)->first(); if ($request->confirmation_code == $candidate->confirmation_code) { $candidate->status = 1; $candidate->confirmation_code = ''; $candidate->save(); return Redirect::route('candidate.login')->with('message', 'Youre account is activated <br>Now Login with your username and password'); } else { return Redirect::back()->withInput()->with('message', 'The OTP Doesnot match!.'); } }
public function suspendCandidate($candidate_id) { $decoded = Hashids::decode($candidate_id); $id = $decoded[0]; $candidate = Candidate::find($decoded)->first(); $candidate->verified_status = 'Halted'; $candidate->verified_by = Auth::admin()->get()->id; if ($candidate->save()) { return redirect()->route('admin.applications_suspended')->with('message', 'The Application has been Halted'); } else { return redirect()->back()->with('message', 'Unable to process your request. Please try again or contact TechSupport.'); } }
public static function check_candidate($id) { $candidate = Candidate::find($id); $info = CandidateInfo::where('candidate_id', $id)->count(); $edu = CandidateEduDetails::where('candidate_id', $id)->count(); $lang = CandidateLanguageInfo::where('candidate_id', $id)->count(); if ($info == 0 || $edu == 0 || $lang == 0) { return false; } else { return true; } }