2017-07-12 10 views

答えて

1

は(OPが質問に次のような答えを掲載根本的な問題がpusher-php-serverのバージョン3は、名前空間を紹介し、今use Pusher\Pusherを必要とすることである。。)

このコマンドを作成します。

namespace App\Console\Commands; 

use Illuminate\Support\Facades\File; 
use Illuminate\Console\Command; 

class FixPusher extends Command 
{ 

    /** 
    * The name and signature of the console command. 
    * 
    * @var string 
    */ 
    protected $signature = 'fix:pusher'; 

    /** 
    * The console command description. 
    * 
    * @var string 
    */ 
    protected $description = 'Fix Pusher namespace issue'; 

    /** 
    * Create a new command instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     parent::__construct(); 
    } 

    /** 
    * Execute the console command. 
    * 
    * @return mixed 
    */ 
    public function handle() 
    { 
     $broadcastManagerPath = base_path('vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php'); 
     $pusherBroadcasterPath = base_path('vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php'); 

     $contents = str_replace('use Pusher;', 'use Pusher\Pusher;', File::get($broadcastManagerPath)); 
     File::put($broadcastManagerPath, $contents); 

     $contents = str_replace('use Pusher;', 'use Pusher\Pusher;', File::get($pusherBroadcasterPath)); 
     File::put($pusherBroadcasterPath, $contents); 
    } 
} 

を次に追加します"php artisan fix:pusher"composer.jsonへのファイル:プッシャーI Rのバージョン3で

"post-update-cmd": [ 
    "php artisan fix:pusher", 
    "Illuminate\\Foundation\\ComposerScripts::postUpdate", 
    "php artisan optimize" 
] 
0

Pusher \ Pusherの名前空間が変更されたことを通知します。 .env、BROADCAST_DRIVER = pusherを設定したときにコンポーザーで設定すると、そのエラーが表示されます。

「ベンダー/ laravel /フレームワーク/ SRC /照らしなさい/放送/ BroadcastManager.php」

:ログをチェックアウトするには、このファイルに位置proble、ある場所を見つけることができます。これは、必要に応じて変更に画像などの代わりに、プッシャーのプッシャー\プッシャーの参照です: enter image description here

、関数PusherBroadCasterを見つけるとプッシャーの基準プッシャーを変更\プッシャー。

enter image description here

ベンダー/ laravel /フレームワーク/ SRC /を照らし/放送/放送/ PusherBroadcaster.php

18

クラウディオの診断が正しい名前空間プッシャーは、バージョン3に添加しました。 Laravelファイルを変更することはお勧めできません。

より良い方法は、別名をconfig/app.phpに作成することです。 [エイリアス]キーの下にある[第三者のエイリアス]セクションの配列に追加します。

'Pusher' => Pusher\Pusher::class, 
関連する問題