bootstrap.js 1.6 KB

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