Как настроить Laravel с Node And Pusher VUE js
Шаг 1 Сначала установите laravel
composer create-project laravel/laravel your-project-name 5.4.*
ШАГ 2 Установить переменные изменить Broadcastserviceprovider
we first need to register the App\Providers\BroadcastServiceProvider. Open
config/app.php and uncomment the following line in the providers array.
// App\Providers\BroadcastServiceProvider
We need to tell Laravel that we are using the Pusher driver in the .env file:
BROADCAST_DRIVER=pusher
add pusher Class in config/app.php
'Pusher' => Pusher\Pusher::class,
ШАГ 3 Добавьте Pusher в ваш проект laravel
composer require pusher/pusher-php-server
ШАГ 4 Добавьте следующее в config / broadcasting.php
'options' => [
'cluster' => env('PUSHER_CLUSTER'),
'encrypted' => true,
],
ШАГ 5 Установите переменную Pusher
PUSHER_APP_ID=xxxxxx
PUSHER_APP_KEY=xxxxxxxxxxxxxxxxxxxx
PUSHER_APP_SECRET=xxxxxxxxxxxxxxxxxxxx
PUSHER_CLUSTER=xx
ШАГ 6 Установочный узел
npm install
ШАГ 7 Installl Pusher js
npm install --save laravel-echo pusher-js
ШАГ 8 uncommnet После
// resources/assets/js/bootstrap.js
import Echo from "laravel-echo"
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'xxxxxxxxxxxxxxxxxxxx',
cluster: 'eu',
encrypted: true
});
ШАГ 9 Перед созданием Миграция
// app/Providers/AppServiceProvider.php
// remember to use
Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}