bootstrap.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. window._ = require('lodash');
  2. /**
  3. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  4. * for JavaScript based Bootstrap features such as modals and tabs. This
  5. * code may be modified to fit the specific needs of your application.
  6. */
  7. try {
  8. window.Popper = require('popper.js').default;
  9. window.$ = window.jQuery = require('jquery');
  10. window.$.cookie=require('js-cookie')
  11. require('bootstrap');
  12. } catch (e) {}
  13. window.moment = require('moment');
  14. window.md5 = require('md5');
  15. /**
  16. * We'll load the axios HTTP library which allows us to easily issue requests
  17. * to our Laravel back-end. This library automatically handles sending the
  18. * CSRF token as a header based on the value of the "XSRF" token cookie.
  19. */
  20. window.axios = require('axios');
  21. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  22. /**
  23. * Next we will register the CSRF Token as a common header with Axios so that
  24. * all outgoing HTTP requests automatically have it attached. This is just
  25. * a simple convenience so we don't have to attach every token manually.
  26. */
  27. let token = document.head.querySelector('meta[name="csrf-token"]');
  28. if (token) {
  29. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  30. } else {
  31. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  32. }
  33. /**
  34. * Echo exposes an expressive API for subscribing to channels and listening
  35. * for events that are broadcast by Laravel. Echo and event broadcasting
  36. * allows your team to easily build robust real-time web applications.
  37. */
  38. import Echo from 'laravel-echo'
  39. //
  40. // const client = require('pusher-js');
  41. window.io = require('socket.io-client');
  42. window.initEcho=function(){
  43. window.Echo = new Echo({
  44. broadcaster: 'socket.io',
  45. host: window.location.hostname + ':6001',
  46. //broadcaster: 'pusher',
  47. // key: process.env.MIX_PUSHER_APP_KEY,
  48. // key: 'bo20alg-1',
  49. // authEndpoint: '/custom/endpoint/auth',
  50. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  51. // encrypted: true,
  52. // client:client
  53. });
  54. };