Skip to content

Commit 455c2c0

Browse files
committed
Update bootstrap.js
1 parent 2a73547 commit 455c2c0

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

src/BulmaPreset.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ protected static function updateSass()
6363
copy(__DIR__.'/bulma-stubs/app.scss', resource_path('assets/sass/app.scss'));
6464
}
6565

66+
67+
/**
68+
* Update the bootstrapping files.
69+
*
70+
* @return void
71+
*/
72+
protected static function updateBootstrapping()
73+
{
74+
(new Filesystem)->delete(
75+
resource_path('assets/js/bootstrap.js')
76+
);
77+
78+
copy(__DIR__.'/bulma-stubs/bootstrap.js', resource_path('assets/js/bootstrap.js'));
79+
}
80+
81+
6682
/**
6783
* Update the default welcome page file with Bulma buttons.
6884
*

src/bulma-stubs/bootstrap.js

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

0 commit comments

Comments
 (0)