Laravel“目标[Illuminate \ Contracts \ Bus \ Dispatcher]无法实例化." [英] Laravel "Target [Illuminate\Contracts\Bus\Dispatcher] is not instantiable."

查看:192
本文介绍了Laravel“目标[Illuminate \ Contracts \ Bus \ Dispatcher]无法实例化."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题本身所说,我遇到了以下问题:目标[Illuminate \ Contracts \ Bus \ Dispatcher]无法实例化..我正在尝试使用自定义脚本并包括默认的Laravel类

As the title itself says, I've got the following issue: Target [Illuminate\Contracts\Bus\Dispatcher] is not instantiable.. I'm trying to use a custom script and include the default Laravel classes

require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/bootstrap/app.php';

use App\Mail\ChangeInStatusMail;
use App\Jobs\SendEmail;

使用SendEmail :: dispatch()后,出现上述错误.有什么想法吗?

After using SendEmail::dispatch() I get the previously mentioned error. Any ideas?

推荐答案

由于我有从laravel 5.2更新到5.8左右的经验,所以我不得不替换' Collective \ Bus \ BusServiceProvider ',在config/app.php中的providers数组中使用" Illuminate \ Bus \ BusServiceProvider ".

Since I have experience of updating from laravel 5.2 to 5.8 or so, I had to replace 'Collective\Bus\BusServiceProvider', with 'Illuminate\Bus\BusServiceProvider', in providers array in config/app.php.

这对我有用,并且密码重置链接上的错误不再出现

This worked for me and the error no more appeared on Password reset link click

这篇关于Laravel“目标[Illuminate \ Contracts \ Bus \ Dispatcher]无法实例化."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆