app/Http/Controllers/TestimonialController.php
/**
	 * Validates the form request and saves the testimonial.
	 *
	 * @param CreateTestimonialRequest $request
	 * @return Illuminate\View\View
	 */
Validates the form request and saves the testimonial.
@param CreateTestimonialRequest $request
@return Illuminate\View\View
Validates the form request and saves the testimonial . @param CreateTestimonialRequest $request @return Illuminate \ View \ View
public function store(CreateTestimonialRequest $request)
	{
		$testimonial = new Testimonial($request->all());
		if ($testimonial->save()) {
			Mail::send('email.testimonial', array(
				'testimonial' => $testimonial
			), function($message) {
				$message->from('automailer@starlearningsystems.com');
				$message->to(ContactController::POSTMASTER_EMAIL, ContactController::POSTMASTER_NAME)->subject('New Customer Testimonial');
			});
			return redirect('testimonials')->with('alert',
				['status' => 'success', 'message' => 'Thank you for submitting your testimonial!']
			);
		} else {
			return back()->withInput()->with('alert',
				['status' => 'danger', 'message' => 'There was an error saving your testimonial. Please try again later.']
			);
		}
	}
public function store ( CreateTestimonialRequest $ request ) { $ testimonial = new Testimonial ( $ request -> all ( ) ) ; if ( $ testimonial -> save ( ) ) { Mail :: send ( 'email.testimonial' , array ( 'testimonial' => $ testimonial ) , function ( $ message ) { $ message -> from ( 'automailer@starlearningsystems.com' ) ; $ message -> to ( ContactController :: POSTMASTER_EMAIL , ContactController :: POSTMASTER_NAME ) -> subject ( 'New Customer Testimonial' ) ; } ) ; return redirect ( 'testimonials' ) -> with ( 'alert' , [ 'status' => 'success' , 'message' => 'Thank you for submitting your testimonial!' ] ) ; } else { return back ( ) -> withInput ( ) -> with ( 'alert' , [ 'status' => 'danger' , 'message' => 'There was an error saving your testimonial. Please try again later.' ] ) ; } }
Validates the form request and saves the testimonial.
Validates the form request and saves the testimonial .