public function doRegister(Request $request)
 {
     $validator = Validator::make($data = $request->all(), Admin::$rules, Admin::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($validator->passes()) {
         $confirmation_code = Str::quickRandom(30);
         $admin = new Admin();
         $admin->fullname = ucwords($request->fullname);
         $admin->mobile_no = $request->mobile_no;
         $admin->email = $request->email;
         $admin->password = bcrypt($request->password);
         $admin->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 ($admin, $data){
         // 	$message->from('no-reply@employment_bank', 'Employment Bank');
         //     	$message->to(Input::get('email'), $admin->name)
         //         	->subject('Verify your email address');
         // });
         if (!$admin->save()) {
             return Redirect::back()->with('message', 'Error while creating your account!<br> Please contact Technical Support');
         }
         return Redirect::route('admin.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);
         // ->with('message', 'There were validation errors.');
     }
 }
 public function viewIdentityCard($candidate_id)
 {
     if (!Basehelper::check_candidate($candidate_id)) {
         return Redirect::back()->with('message', 'The Profile has not enough information available to view Identity Card!');
     }
     $result = Candidate::join('candidate_infos', 'candidates.id', '=', 'candidate_infos.candidate_id')->join('master_casts', 'candidate_infos.caste_id', '=', 'master_casts.id')->join('master_proof_details', 'candidate_infos.proof_details_id', '=', 'master_proof_details.id')->join('candidate_edu_details', 'candidates.id', '=', 'candidate_edu_details.candidate_id')->join('master_exams', 'candidate_edu_details.exam_id', '=', 'master_exams.id')->join('master_subjects', 'candidate_edu_details.subject_id', '=', 'master_subjects.id')->select('candidates.id', 'candidate_infos.fullname', 'candidate_infos.index_card_no', 'candidate_infos.created_at', 'candidate_infos.dob', 'candidate_infos.physical_challenge', 'candidate_infos.ex_service', 'master_casts.name as caste', 'master_exams.name as exam_name', 'master_subjects.name as subject', 'master_proof_details.name as id_proof', 'candidate_infos.proof_no', 'candidate_infos.photo_url')->where('candidates.id', $candidate_id)->get();
     //return Hashids::encode($result->photo_url);
     return view('admin.identitycard', compact('result'));
 }
 public function storeJob(Request $request)
 {
     if (Auth::employer()->get()->verified_by == 0 || Auth::employer()->get()->enrollment_no == '') {
         return redirect()->back()->withInput()->with('message', Basehelper::getMessage('employer_not_active'));
     }
     $validator = Validator::make($data = $request->all(), PostedJob::$rules, PostedJob::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput()->with('message', 'Some fields has errors. Please correct it and then try again');
     }
     $data['created_by'] = Auth::employer()->get()->id;
     DB::beginTransaction();
     //Generate Job id
     $records = PostedJob::withTrashed()->count();
     $current_id = 1;
     if (!$records == 0) {
         $current_id = PostedJob::withTrashed()->orderBy('id', 'DESC')->first()->id + 1;
     }
     $job_id = 'EMPJOB' . str_pad($current_id, 6, '0', STR_PAD_LEFT);
     $data['emp_job_id'] = $job_id;
     $data['status'] = 1;
     //so that by default it gets activated
     $job = PostedJob::create($data);
     if (!$job) {
         DB::rollbackTransaction();
         return Redirect::back()->withInput()->with('message', 'Unable to process your request');
     }
     DB::commit();
     return Redirect::route($this->route . 'list_job')->with('message', 'New Job has been Posted!');
 }