bootstrap.js 1.7 KB

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