Created
January 22, 2015 02:35
-
-
Save DuffleOne/9174ec2c0482b3ba7a10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Show Contact | |
public function contact() | |
{ | |
return View::make('pages.about.contact')->withInput([]); | |
} | |
// Process Contact | |
public function processContact() | |
{ | |
$input = Input::all(); | |
try | |
{ | |
$this->contactForm->validate($input); // do validation here, dont need to use laracasts/valdation. | |
// Make sure the valiator throws an exception if it fails. | |
$input['message'] = nl2br($input['message']); | |
$data['ipaddr'] = Request::server('REMOTE_ADDR'); | |
$data['header'] = Request::server('HTTP_USER_AGENT'); | |
$data['form'] = 'Contact Form'; | |
$this->mailer->send($data); // here is where you do logic and stuff, I send an email | |
Flash::success('Thank you for your message.'); | |
return View::make('pages.about.contact')->withInput([]); | |
} catch (FormValidationException $e) | |
{ | |
return Redirect::back()->withInput()->withErrors($e->getErrors()); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment