From solid state to soft matter : photonic nanocavities as advanced optoelectronic devices and single-cell biomedical probes