jeudi 28 décembre 2017

Uncaught ReferenceError: Echo is not defined

I almost dont have any ideas about javascript. I watched some videos to make real time chat for my project and i get these errors.

Notes : Before this real time chat was working nice, just something easy happened and not its not working and i really dont know why its happening. I need your help, thank you in advance!..

app.js:59006 Uncaught ReferenceError: Echo is not defined
    at Object.<anonymous> (app.js:59006)
    at __webpack_require__ (app.js:20)
    at Object.VERSION (app.js:28107)
    at __webpack_require__ (app.js:20)
    at Object.defineProperty.value (app.js:28043)
    at __webpack_require__ (app.js:20)
    at Object.<anonymous> (app.js:28028)
    at __webpack_require__ (app.js:20)
    at app.js:63
    at app.js:66

When I press this error shows this :

Echo.join('chat').here(function (users) { X

    __WEBPACK_IMPORTED_MODULE_0__bus__["a" /* default */].$emit('users.here', users);
}).joining(function (user) {

    __WEBPACK_IMPORTED_MODULE_0__bus__["a" /* default */].$emit('users.joined', user);
}).leaving(function (user) {

    __WEBPACK_IMPORTED_MODULE_0__bus__["a" /* default */].$emit('users.left', user);
}).listen('MessageCreated', function (e) {

    __WEBPACK_IMPORTED_MODULE_0__bus__["a" /* default */].$emit('messages.added', e.message());
});

bootstrap.js

require('./echo')

import Echo from "laravel-echo"

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: Laravel.keys.pusher,
    cluster : 'eu',
    encrypted : true
});

view part

   <script src=""></script>

    <script>

        window.Laravel = {!! json_encode([

            'csrfToken' => csrf_token(),
            'user' => [
                'authenticated' => auth()->check(),
                'id' => auth()->check() ? auth()->user()->id : null,
                'name' => auth()->check() ? auth()->user()->name : null
            ],

            'keys' => [
                'pusher' => config('broadcasting.connections.pusher.key')
            ]

        ]) !!};


    </script>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2CjC4Tm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire