public function post_create() { $new_testimonial = array('client' => trim(Input::get('client')), 'testimonial' => trim(Input::get('testimonial')), 'visibility' => trim(Input::get('visible')) ? true : false); // set up rules for new data $rules = array('client' => 'required|min:3|max:128', 'testimonial' => 'required'); // make the validator $v = Validator::make($new_testimonial, $rules); if ($v->fails()) { // redirect to form // errors return Redirect::to('user/testimonials/create')->with('user', Auth::user())->with_errors($v)->with_input(); } // create the new testimonial $testimonial = new Testimonial($new_testimonial); $testimonial->save(); // add organisations to Organisation_Testimonial foreach (Input::get('organisations') as $org_id) { $testimonial->organisations()->attach($org_id); } // redirect to testimonial return Redirect::to('user/testimonials')->with('success', 'A new testimonial has been created'); }