Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 28f1932

Browse files
committed
initial commit
1 parent 8034a54 commit 28f1932

File tree

3 files changed

+23
-37
lines changed

3 files changed

+23
-37
lines changed

‎resources/js/mixins/message.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script>
2+
3+
export default {
4+
methods: {
5+
$show_message (title, message, variant) {
6+
this.$bvToast.toast(message, {
7+
title: title,
8+
variant: variant,
9+
solid: true
10+
})
11+
}
12+
}
13+
}
14+
</script>

‎resources/js/pages/home.vue

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<b-form-input
1111
type="text"
1212
id="title"
13-
name="title"
1413
:class="{ 'is-invalid': form.errors.has('title') }"
1514
v-model="form.title">
1615
</b-form-input>
@@ -23,7 +22,6 @@
2322
label-for="user_id">
2423
<v-select
2524
id="user_id"
26-
name="user_id"
2725
v-model="form.user_id"
2826
:searchable="true"
2927
:clearable="false"
@@ -41,7 +39,6 @@
4139
label-for="description">
4240
<b-form-textarea
4341
id="description"
44-
name="description"
4542
:class="{ 'is-invalid': form.errors.has('description') }"
4643
v-model="form.description"
4744
rows="3"
@@ -85,7 +82,6 @@
8582
<b-form-input
8683
type="text"
8784
id="edit_title"
88-
name="edit_title"
8985
:class="{ 'is-invalid': editform.errors.has('title') }"
9086
v-model="editform.title">
9187
</b-form-input>
@@ -98,7 +94,6 @@
9894
label-for="edit_user_id">
9995
<v-select
10096
id="edit_user_id"
101-
name="edit_user_id"
10297
v-model="editform.user_id"
10398
:searchable="true"
10499
:clearable="false"
@@ -116,7 +111,6 @@
116111
label-for="edit_description">
117112
<b-form-textarea
118113
id="edit_description"
119-
name="edit_description"
120114
:class="{ 'is-invalid': editform.errors.has('description') }"
121115
v-model="editform.description"
122116
rows="3"
@@ -216,55 +210,31 @@ export default {
216210
const { data } = await this.form.post('/api/posts')
217211
if (data.id > 0)
218212
{
219-
this.$bvToast.toast('The post was created successfully', {
220-
title: `Notification`,
221-
variant: 'success',
222-
solid: true
223-
})
213+
this.$show_message(`Notification`, 'The post was created successfully', 'success');
224214
this.create_modal_show = false;
225215
this.loadPosts();
226216
} else {
227-
this.$bvToast.toast('Post creating operation was failed', {
228-
title: `Notification`,
229-
variant: 'danger',
230-
solid: true
231-
})
217+
this.$show_message(`Notification`, 'Post creating operation was failed', 'danger');
232218
}
233219
},
234220
async save_post() {
235221
const { data } = await this.editform.post('/api/posts/' + this.editform.id)
236222
if (data.id > 0)
237223
{
238-
this.$bvToast.toast('The post was updated successfully', {
239-
title: `Notification`,
240-
variant: 'success',
241-
solid: true
242-
})
224+
this.$show_message(`Notification`, 'The post was updated successfully', 'success');
243225
this.edit_modal_show = false;
244226
this.loadPosts();
245227
} else {
246-
this.$bvToast.toast('Post updating operation was failed', {
247-
title: `Notification`,
248-
variant: 'danger',
249-
solid: true
250-
})
228+
this.$show_message(`Notification`, 'Post updating operation was failed', 'danger');
251229
}
252230
},
253231
async deleteItem(id) {
254232
const { data } = await this.editform.delete('/api/posts/' + id)
255233
if (data.status === "success")
256234
{
257-
this.$bvToast.toast('The post was deleted successfully', {
258-
title: `Notification`,
259-
variant: 'success',
260-
solid: true
261-
})
235+
this.$show_message(`Notification`, 'The post was deleted successfully', 'success');
262236
} else {
263-
this.$bvToast.toast('Post deleting operation was failed', {
264-
title: `Notification`,
265-
variant: 'danger',
266-
solid: true
267-
})
237+
this.$show_message(`Notification`, 'Post deleting operation was failed', 'danger');
268238
}
269239
this.loadPosts();
270240
}

‎resources/js/store/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import 'bootstrap/dist/css/bootstrap.css'
55
import 'bootstrap-vue/dist/bootstrap-vue.css'
66
import vSelect from 'vue-select'
77
import 'vue-select/dist/vue-select.css';
8-
8+
importtoastfrom'../mixins/message'
99

1010
Vue.use(BootstrapVue)
1111
Vue.use(IconsPlugin)
1212
Vue.use(FormSelectPlugin)
1313
Vue.use(Vuex)
1414

15+
Vue.mixin(toast)
16+
1517
Vue.component('v-select', vSelect)
1618

1719
// Load store modules dynamically.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /