PHP Classes

File: resources/assets/js/components/CreateGroup.vue

Recommend this page to a friend!
  Classes of Nyi Nyi Lwin  >  Laravel Group Chat  >  resources/assets/js/components/CreateGroup.vue  >  Download  
File: resources/assets/js/components/CreateGroup.vue
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Laravel Group Chat
Interactive chat module for multiple users
Author: By
Last change:
Date: 2 months ago
Size: 1,658 bytes
 

Contents

Class file image Download
<template>
    <div class="box box-solid">
        <div class="box-header">
            <h3 class="box-title">Create Group</h3>
            <div class="box-tools">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
            </div>
        </div>
        <form role="form">
            <div class="box-body">
                <div class="form-group">
                    <input class="form-control" type="text" v-model="name" placeholder="Group Name">
                </div>
                <div class="form-group">
                    <select class="form-control" v-model="users" multiple id="friends">
                        <option v-for="user in initialUsers" :value="user.id">
                            {{ user.name }}
                        </option>
                    </select>
                </div>
                <button type="submit" @click.prevent="createGroup" class="btn btn-primary">Create Group</button>
            </div>
        </form>
    </div>
</template>

<script>
    export default {
        props: ['initialUsers' , 'currentUser'],

        data() {
            return {
                name: '',
                users: []
            }
        },

        methods: {
            createGroup() {
                axios.post('/groups', {name: this.name, users: this.users, user_id: this.currentUser.id})
                .then((response) => {
                    this.name = '';
                    this.users = [];
                    Bus.$emit('groupCreated', response.data);
                });
            }
        }
    }
</script>
For more information send a message to info at phpclasses dot org.