예제 #1
0
 public function index()
 {
     return Acudiente::all();
 }
예제 #2
0
 public function putCreartodoslosusuarios()
 {
     $user = User::fromToken();
     $alumnos = Alumno::all();
     foreach ($alumnos as $alumno) {
         if ($alumno->user_id) {
             $utemp = User::find($alumno->user_id);
             if (!$utemp) {
                 $this->createAndAsignUser($alumno, 'Alumno');
             }
         } else {
             $this->createAndAsignUser($alumno, 'Alumno');
         }
     }
     $profesores = Profesor::all();
     foreach ($profesores as $profesor) {
         if ($profesor->user_id) {
             $utemp = User::find($profesor->user_id);
             if (!$utemp) {
                 $this->createAndAsignUser($profesor, 'Profesor');
             }
         } else {
             $this->createAndAsignUser($profesor, 'Profesor');
         }
     }
     $acudientes = Acudiente::all();
     foreach ($acudientes as $acudiente) {
         if ($acudiente->user_id) {
             $utemp = User::find($acudiente->user_id);
             if (!$utemp) {
                 $this->createAndAsignUser($acudiente, 'Acudiente');
             }
         } else {
             $this->createAndAsignUser($acudiente, 'Acudiente');
         }
     }
     return 'Usuarios creados con éxito';
 }