1
|
|
|
/** |
2
|
|
|
* This bootstrap file is used for both frontend and backend |
3
|
|
|
*/ |
4
|
|
|
|
5
|
|
|
import _ from 'lodash' |
6
|
|
|
import axios from 'axios' |
7
|
|
|
import swal from 'sweetalert2' |
8
|
|
|
import $ from 'jquery' |
9
|
|
|
import 'popper.js/dist/umd/popper' // Required for BS4 |
10
|
|
|
import 'bootstrap' |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Font Awesome >=5.1 |
14
|
|
|
* |
15
|
|
|
* Is recommended import just the icons that you use, for decrease considerably the file size. |
16
|
|
|
* You can see at next link, how it works: https://github.com/FortAwesome/Font-Awesome/blob/master/UPGRADING.md#no-more-default-imports |
17
|
|
|
* Also you can import the icons separately on the frontend and backend |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
import { library, dom } from '@fortawesome/fontawesome-svg-core' |
21
|
|
|
import { fab } from '@fortawesome/free-brands-svg-icons' |
22
|
|
|
import { far } from '@fortawesome/free-regular-svg-icons' |
23
|
|
|
import { fas } from '@fortawesome/free-solid-svg-icons' |
24
|
|
|
|
25
|
|
|
library.add(fab, far, fas) |
26
|
|
|
|
27
|
|
|
// Kicks off the process of finding <i> tags and replacing with <svg> |
28
|
|
|
dom.watch() |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* We'll load jQuery and the Bootstrap jQuery plugin which provides support |
32
|
|
|
* for JavaScript based Bootstrap features such as modals and tabs. This |
33
|
|
|
* code may be modified to fit the specific needs of your application. |
34
|
|
|
*/ |
35
|
|
|
|
36
|
|
|
window.$ = window.jQuery = $ |
37
|
|
|
window.swal = swal |
38
|
|
|
window._ = _ // Lodash |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* We'll load the axios HTTP library which allows us to easily issue requests |
42
|
|
|
* to our Laravel back-end. This library automatically handles sending the |
43
|
|
|
* CSRF token as a header based on the value of the "XSRF" token cookie. |
44
|
|
|
*/ |
45
|
|
|
|
46
|
|
|
window.axios = axios |
47
|
|
|
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Next we will register the CSRF Token as a common header with Axios so that |
51
|
|
|
* all outgoing HTTP requests automatically have it attached. This is just |
52
|
|
|
* a simple convenience so we don't have to attach every token manually. |
53
|
|
|
*/ |
54
|
|
|
|
55
|
|
|
const token = document.head.querySelector('meta[name="csrf-token"]') |
56
|
|
|
|
57
|
|
|
if (token) { |
58
|
|
|
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content |
59
|
|
|
} else { |
60
|
|
|
console.error( |
61
|
|
|
'CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token' |
62
|
|
|
) |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Echo exposes an expressive API for subscribing to channels and listening |
67
|
|
|
* for events that are broadcast by Laravel. Echo and event broadcasting |
68
|
|
|
* allows your team to easily build robust real-time web applications. |
69
|
|
|
*/ |
70
|
|
|
|
71
|
|
|
// import Echo from 'laravel-echo' |
72
|
|
|
|
73
|
|
|
// window.Pusher = require('pusher-js'); |
74
|
|
|
|
75
|
|
|
// window.Echo = new Echo({ |
76
|
|
|
// broadcaster: 'pusher', |
77
|
|
|
// key: process.env.MIX_PUSHER_APP_KEY |
78
|
|
|
// cluster: process.env.MIX_PUSHER_APP_CLUSTER, |
79
|
|
|
// encrypted: true |
80
|
|
|
// }); |
81
|
|
|
|