目标[Illuminate \ Contracts \ Broadcasting \ Factory]无法实例化

时间:2019-10-15 20:18:47

标签: php laravel laravel-5 laravel-5.7 broadcasting

我不断得到

Target [Illuminate\Contracts\Broadcasting\Factory] is not instantiable.

我添加

App\Providers\BroadcastServiceProvider::class,

进入我的app.php,有人可以帮忙吗?

已更新

'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    'Illuminate\Cache\CacheServiceProvider',
    'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
    'Illuminate\Cookie\CookieServiceProvider',
    'Illuminate\Database\DatabaseServiceProvider',
    'Illuminate\Encryption\EncryptionServiceProvider',
    'Illuminate\Filesystem\FilesystemServiceProvider',
    'Illuminate\Foundation\Providers\FoundationServiceProvider',
    'Illuminate\Hashing\HashServiceProvider',
    'Illuminate\Mail\MailServiceProvider',
    'Illuminate\Pagination\PaginationServiceProvider',
    'Illuminate\Pipeline\PipelineServiceProvider',
    'Illuminate\Queue\QueueServiceProvider',
    'Illuminate\Redis\RedisServiceProvider',
    'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
    'Illuminate\Session\SessionServiceProvider',
    'Illuminate\Translation\TranslationServiceProvider',
    'Illuminate\Validation\ValidationServiceProvider',
    'Illuminate\View\ViewServiceProvider',
    Collective\Html\HtmlServiceProvider::class,

    /*
     * Application Service Providers...
     */
    'App\Providers\AppServiceProvider',
    'App\Providers\ConfigServiceProvider',
    'App\Providers\EventServiceProvider',
    'App\Providers\RouteServiceProvider',

    Intervention\Image\ImageServiceProvider::class,
    Collective\Remote\RemoteServiceProvider::class,
    HTMLMin\HTMLMin\HTMLMinServiceProvider::class,
    Illuminate\Notifications\NotificationServiceProvider::class,
    App\Providers\BroadcastServiceProvider::class,


],

app / Providers / BroadcastServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;

class BroadcastServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Broadcast::routes();

        require base_path('routes/channels.php');
    }
}

1 个答案:

答案 0 :(得分:3)

您在Illuminate\Broadcasting\BroadcastServiceProvider列表中缺少providers

我相信这是5.1升级指南的一部分。