【发布时间】:2016-01-26 15:20:21
【问题描述】:
我正在尝试设置一个使用 Storage 外观的作业。不幸的是,这不起作用并引发异常。
'Symfony\Component\HttpFoundation\File\File' 的序列化不是 允许
class MoveMusicToRemoteStorage extends Job implements SelfHandling, ShouldQueue
{
use InteractsWithQueue, DispatchesJobs;
private $audio;
public function __construct(AudioFile $audio)
{
$this->audio = $audio;
}
public function handle()
{
Storage::disk('s3')->put('/audio/' . $this->audio->file()->getFilename(), file_get_contents($this->audio->getPath()));
}
}
如何在作业中使用 Facade?p>
编辑
我已阅读this post,但我不拥有 File 类,因此我无法使其可序列化。
【问题讨论】:
-
@MahmoudTantawy 不,这与我的问题不同
-
是的,因为这就是问题所在。阅读异常消息。