bootstrap.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. require('bootstrap');
  11. } catch (e) {}
  12. /**
  13. * We'll load the axios HTTP library which allows us to easily issue requests
  14. * to our Laravel back-end. This library automatically handles sending the
  15. * CSRF token as a header based on the value of the "XSRF" token cookie.
  16. */
  17. window.axios = require('axios');
  18. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  19. /**
  20. * Next we will register the CSRF Token as a common header with Axios so that
  21. * all outgoing HTTP requests automatically have it attached. This is just
  22. * a simple convenience so we don't have to attach every token manually.
  23. */
  24. let token = document.head.querySelector('meta[name="csrf-token"]');
  25. if (token) {
  26. window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  27. } else {
  28. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  29. }
  30. /**
  31. * Echo exposes an expressive API for subscribing to channels and listening
  32. * for events that are broadcast by Laravel. Echo and event broadcasting
  33. * allows your team to easily build robust real-time web applications.
  34. */
  35. // import Echo from 'laravel-echo'
  36. // window.Pusher = require('pusher-js');
  37. // window.Echo = new Echo({
  38. // broadcaster: 'pusher',
  39. // key: process.env.MIX_PUSHER_APP_KEY,
  40. // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
  41. // encrypted: true
  42. // });