public function updateAction()
 {
     try {
         $id = Input::get('class');
         $school = Input::get('hiddenSchools');
         $name = Input::get('name');
         $description = Input::get('description');
         $publish = Input::get('publish');
         $class = Classes::find($id);
         $class->name = $name;
         $class->description = $description;
         $class->published = $publish;
         $class->save();
         DB::table('schoolclass')->where('class', $id)->delete();
         $schools = explode(',', $school);
         for ($i = 0; $i < count($schools); $i++) {
             if ($schools[$i] != "") {
                 $schoolclass = new Schoolclass();
                 $schoolclass->school = $schools[$i];
                 $schoolclass->class = $id;
                 $schoolclass->save();
             }
         }
         //Session::put('id', $id);
         Session::flash('status_success', 'Successfully Updated.');
         return Redirect::route('admin/classEdit', array('id' => $id));
         //return Redirect::route('admin/classEdit');
     } catch (Exception $ex) {
         echo $ex;
         Session::flash('status_error', '');
     }
 }
 public function classesAction()
 {
     try {
         $id = Input::get('school');
         $class = Input::get('hiddenClasses');
         $classes_info = substr($class, 0, strlen($class) - 1);
         $classes_array = explode(',', $classes_info);
         DB::table('schoolclass')->where('school', $id)->delete();
         for ($i = 0; $i < count($classes_array); $i++) {
             if ($classes_array[$i] != "") {
                 $schoolclass = new Schoolclass();
                 $schoolclass->school = $id;
                 $schoolclass->class = $classes_array[$i];
                 $schoolclass->save();
             }
         }
         return Redirect::route('admin/schoolEdit', array('id' => $id));
     } catch (Exception $ex) {
         echo $ex;
         Session::flash('status_error', '');
     }
 }