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