微信认证写在中间件里,当中有个SaveUserAvatar的操作,是下载用户头像的。打算把这个操作放在队列中执行,但在中间件中如何推送队列?按文档的方法$this->dispatch(new SaveUserAvatar($user))
会报错,提示信息为Fatal error: Call to undefined method App\Http\Middleware\Authenticate::dispatch()
。
Laravel 5.1
1
jhdxr 2016-04-15 00:49:12 +08:00 1
RTFM ,然后可以节省彼此的时间
> Of course, sometimes you may wish to dispatch a job from somewhere in your application besides a route or controller. For that reason, you can include the `DispatchesJobs` trait on any of the classes in your application to gain access to its various dispatch methods. |
3
CodingWorker 2016-05-04 14:51:55 +08:00
查缺补漏,感谢
|