コード例 #1
0
 /**
  * Store a newly created notificacione in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Notificacion::$rules);
     $data = array_add($notificaciones, 'user_id', Auth::user()->id);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $notificacion = Notificacion::create($data);
     return Response::json($notificacion, 200);
 }
コード例 #2
0
ファイル: subirApunte.php プロジェクト: nemoNoboru/ET3
 if ($_FILES["apunteUploaded"]["type"] == "application/pdf") {
     if (is_uploaded_file($_FILES['apunteUploaded']['tmp_name'])) {
         if (move_uploaded_file($_FILES['apunteUploaded']['tmp_name'], $target)) {
             $titulo = "El apunte " . basename($_FILES['apunteUploaded']['name']) . " ha sido subido correctamente";
             $matuser = new Materia_usuario($db);
             $notificacion = new Notificacion($db);
             $materia = new Materia($db);
             $date = getdate();
             $buffer = $date['year'] . "-" . $date['mon'] . "-" . $date['mday'];
             $mat = $materia->findBy('mat_id', $apunte->getMat_id())[0]->getMat_name();
             $array = $matuser->findBy('mat_id', $apunte->getMat_id());
             foreach ($array as $arrays) {
                 $notificacion->setFecha($buffer);
                 $notificacion->setContenido("Nuevos apuntes en " . $mat);
                 $notificacion->setUser_id($arrays->getUser_id());
                 $notificacion->create();
             }
         } else {
             $titulo = "Error subiendo el apunte.";
             $contenido = "Ha ocurrido un error inesperado. Compruebe los datos de entrada, pruebe otra vez y si el error sigue ocurriendo contacte con un administrador";
         }
     }
 } else {
     $titulo = "fichero invalido";
     $contenido = "compruebe que su fichero es .pdf";
 }
 //fin operacion subir archivo
 $apunte->setRuta($hashedName);
 $apunte->create();
 //se crea en la BD el nuevo apunte
 $renderSubirApunte->modal = renderModal($titulo, $contenido);