示例#1
0
 public function agregarAsignatura()
 {
     if (Request::ajax()) {
         $new_asignatura = new Asignatura();
         $new_asignatura->nombre = Input::get("nombre");
         $new_asignatura->academia_id = Academia::academiaPDAActual();
         if ($new_asignatura->validate()) {
             $new_asignatura->save();
             if ($new_asignatura) {
                 return Response::json(array('success' => true));
             }
         } else {
             return Response::json(array('success' => false, 'errores' => $new_asignatura->errors()->toArray()));
         }
     }
 }