0
laravelのキュー(Bean)を使用してファイルをアップロードしようとしていますが、このエラーが発生します:'Illuminate \ Http \ UploadedFile'許可されていないLaravelキューエラー 'Illuminate Http UploadedFile'のシリアル化が許可されていません
私のコードです:
protected $file;
protected $Id;
public function __construct($file,$Id)
{
$this->file = $file
$this->Id = $Id;
}
public function handle()
{
$qFile = $this->file;
$qId = $this->Id;
$s3 = Storage::disk('s3');
$extension = $qFile->guessExtension();
$filename = uniqid().'.'.$extension;
//Create and resize images
$image = Image::make($qFile)->resize(null, 600, function ($constraint) {
$constraint->aspectRatio();
});
$image->encode($extension);
$imageLarge = Image::make($qFile)->resize(null, 800, function ($constraint) {
$constraint->aspectRatio();
});
$imageLarge->encode($extension);
// upload image to S3
$s3->put("images/{$qId}/main/".$filename, (string) $image, 'public');
$s3->put("images/{$qId}/large/".$filename, (string) $imageLarge, 'public');
// make image entry to DB
File::create([
'a_f_id' => $qId,
'file_name' => $filename,
]);
}
しかし、私は削除する場合:$ファイルを保護
。 protected $ Id;
私はエラーを受け取りません
'protected $ file'を' private $ file'に変更しようとしましたか? –