Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <template>
  2. <div class = "col-9 " >
  3. <div class = "col-sm" v-for = "oferta in ofertas": key = "oferta.id" >
  4. <img class = "img-circle": src = "getFoto()" alt = "" >
  5. <div class = "card-body" >
  6. <h5 class = "card-title" > {{ oferta.foto }} < /h5>
  7. <p class = "card-text" > {{ oferta.precioNormal }} < /p>
  8. <!-- <a href="/usuarios/{{oferta.precioOferta}}" class="btn btn-primary">Ver mas </a>-->
  9. </div>
  10. </div>
  11. </div>
  12. </template>
  13.  
  14. <script >
  15. export default {
  16. data() {
  17. return {
  18. ofertas: {},
  19. foto: ''
  20. ////data////
  21. }
  22. },
  23. methods: {
  24. getFoto() {
  25. return "img/profile/" + this.foto;
  26. },
  27.  
  28. /*--------------------------------------------------------------*/
  29. //cargo las ofertas
  30. cargarOferta() {
  31. //pregunto con axios a la ruta del servidor de la API
  32. axios.get("api/oferta").then(({
  33. data
  34. }) => (this.ofertas = data.data));
  35. }
  36.  
  37.  
  38.  
  39. },
  40.  
  41. created() {
  42. this.cargarOferta();
  43. Fire.$on('AfterCreate', () => {
  44. this.cargarOferta();
  45. })
  46. // setInterval(()=>this.cargarOferta(),3000);
  47. }
  48. }
  49. </script>
  50.  
  51. public function index()
  52. {
  53. return oferta::latest()->paginate(10);
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement