public function postRegister(Request $request) { $regrule = array('fname' => 'required', 'email' => 'required|unique:users,email', 'password' => 'required|confirmed', 'university' => 'required'); $messages = ['university.required' => 'Please specify your UG/PG/PHD etc. university', 'email.required' => 'Email is required', 'email.unique' => 'Email already exist', 'fname.required' => 'Full Name require']; $validator = Validator::make(Input::all(), $regrule, $messages); if ($validator->fails()) { $messages = $validator->messages(); /*$response = array( 'status'=>'error', 'message'=>$messages, ); return Response::json($response, 412);*/ return redirect('auth/register')->withErrors($validator)->withInput(); } // create new user $newuser = new User(); $newuser->username = Input::get('email'); $newuser->email = Input::get('email'); $newuser->role = Input::get('role'); $newuser->password = bcrypt(Input::get('password')); $newuser->save(); // update profile too $newprofile = new Profile(); $newprofile->university_id = Input::get('university'); $newprofile->fullname = Input::get('fname'); $newprofile->contact_email = Input::get('email'); $newprofile->user_id = $newuser->id; $newprofile->save(); // send mail link for varification $verifiedemail = new Verifiedemail(); $verifiedemail->user_id = $newuser->id; $verifiedemail->email = Input::get('email'); $verifiedemail->token = uniqid(); $verifiedemail->save(); // send mail $data = ['name' => Input::get('fname'), 'token' => $verifiedemail->token, 'email' => Input::get('email')]; $emails = [Input::get('email')]; $subject = 'MyWorkDetails : Email Verification'; $template = 'welcome'; $this->SENDMAIL($emails, $subject, $template, $data); /*$response = array( 'status'=>'success', 'data'=>['redirectto'=>'auth/login','flash_message'=>'Check your mail to get email verified and get started'], ); return Response::json($response, 200);*/ return redirect('auth/login')->with('messages', 'Check your mail to get email verified and get started'); }
/** * Show the application dashboard to the user. * * @return Response */ public function getProfile() { $getprifile = Profile::where('user_id', '=', Auth::user()->id)->first(); return view('employee.profile'); }