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