public static function add_field() { if (isset($_POST["mytext"]) != '') { foreach ($_POST["mytext"] as $labelField) { if ($labelField != '') { $field = Field::firstOrNew(array('student_label' => $labelField)); $field->save(); } } } return Redirect::back()->with('msg', 'Field was successfuly updated'); }