public function postRegister(Request $Request) { $input = Input::all(); $rules = ['name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required', 'password_confirmation' => 'required|same:password']; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return redirect('/register')->withErrors($validator); } else { $obj = new user(); $obj->name = Input::get('name'); $obj->email = Input::get('email'); $obj->password = hash::make(Request::get('password')); $obj->status = 'unactive'; $obj->active_token = md5(time()); $obj->save(); $obj->sendMail(Input::get('email'), Input::get('name'), $obj->active_token, $obj->id); return redirect('/auth/login')->withErrors(['error' => 'Please check Email active account ']); } }