我尝试从laravel 5.3
升级5.2
,我在php artisan clear-compiled
Class App \ Providers \ BroadcastServiceProvider包含1个摘要 因此,必须声明为抽象或实现 其余方法(Illuminate \ Support \ ServiceProvider :: register)
但是,在我的本地环境升级时,我没有遇到过这样的问题。
config/broadcasting.php
如下:
<?php
return [
'default' => env('BROADCAST_DRIVER', 'log'),
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_KEY'),
'secret' => env('PUSHER_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
],
];
app/Providers/BroadcastServiceProvider.php
如下:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
public function boot()
{
Broadcast::routes();
Broadcast::channel('App.User.{userId}', function ($user, $userId) {
return (int) $user->id === (int) $userId;
});
}
}
.env
如下:
CACHE_DRIVER=file
SESSION_DRIVER=file
#BROADCAST_DRIVER=pusher
PUSHER_KEY=someKey
PUSHER_SECRET=SomeSecrete
PUSHER_APP_ID=SomeId
我尝试将默认broadcasting driver
设置为log
,但似乎无效。
我正在运行的任何命令:
php artisan cache:clear
或php artisan config:clear
或php artisan view:clear
或php artisan clear-compiled
,我面临同样的错误。
我也尝试使用composer dump-autoload
,它运行正常,但之后如果我再次运行php artisan clear-compiled
,那么也会遇到同样的错误。
请帮帮我。
答案 0 :(得分:1)
看起来你并没有真正更新框架,因为Illuminate\Support\ServiceProvider::register
方法存在于5.2而不是5.3中
仔细检查您的更新
答案 1 :(得分:1)
我已修复此错误,方法是先将artisan
命令更新composer
至upgrade to laravel 5.3
。
命令是:
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan clear-compiled
然后再做
composer update
升级到laravel 5.3
时会解决上述错误。