Example #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     die;
     $paises = Pais::all();
     $provincias = Provincia::all();
     $departamentos = Departamento::all();
     $localidades = Localidad::all();
     $calles = Calle::all();
     $domicilios = Domicilio::all();
     $telefonos = Telefono::all();
     $emails = Email::all();
     $webs = Web::all();
 }
 public function updTelefonos($persona_id, $request)
 {
     if ($request->get('numero') != '') {
         $tipo_telefono_id = 1;
         $tipo_telefono = TiposTelefonos::where('id', $request->get('tipo_telefono_id'))->first();
         if (!is_null($tipo_telefono)) {
             $tipo_telefono_id = $tipo_telefono->id;
         }
         // Al permitir varios telefonos, esto tiene que cambiar
         $telefono = Telefono::firstOrNew(['persona_id' => $persona_id]);
         $telefono->fill($request->all());
         $telefono->persona_id = $persona_id;
         $telefono->tipo_telefono_id = $tipo_telefono_id;
         $telefono->save();
     } else {
         $telefono = Telefono::where('persona_id', $persona_id)->first();
         if (!is_null($telefono)) {
             $telefono->forceDelete();
         }
     }
 }