app/Http/Controllers/ContactController.php
/**
	 * Validates the form request and sends an email.
	 *
	 * @param ContactFormRequest $request
	 * @return Illuminate\View\View
	 */
Validates the form request and sends an email.
@param ContactFormRequest $request
@return Illuminate\View\View
Validates the form request and sends an email . @param ContactFormRequest $request @return Illuminate \ View \ View
public function store(ContactFormRequest $request)
	{
		$name = $request->get('first_name') . ' ' . $request->get('last_name');
		$email = $request->get('email');
		$subject = $request->get('subject');
		Mail::send('email.contact', array(
			'name' => $name,
			'email' => $email,
			'user_message' => $request->get('message')
		), function($message) use ($name, $email, $subject) {
			$message->from($email, $name);
			$message->to(self::POSTMASTER_EMAIL, self::POSTMASTER_NAME)->subject($subject);
		});
		return redirect('contact')->with('alert', array('status' => 'success', 'message' => 'Thank you for your feedback!'));
	}
public function store ( ContactFormRequest $ request ) { $ name = $ request -> get ( 'first_name' ) . ' ' . $ request -> get ( 'last_name' ) ; $ email = $ request -> get ( 'email' ) ; $ subject = $ request -> get ( 'subject' ) ; Mail :: send ( 'email.contact' , array ( 'name' => $ name , 'email' => $ email , 'user_message' => $ request -> get ( 'message' ) ) , function ( $ message ) use ( $ name , $ email , $ subject ) { $ message -> from ( $ email , $ name ) ; $ message -> to ( self :: POSTMASTER_EMAIL , self :: POSTMASTER_NAME ) -> subject ( $ subject ) ; } ) ; return redirect ( 'contact' ) -> with ( 'alert' , array ( 'status' => 'success' , 'message' => 'Thank you for your feedback!' ) ) ; }
Validates the form request and sends an email.
Validates the form request and sends an email .