Level 41
$this->images is like an array of files, which cannot be assigned to the filename attribute.
1 like
I tried uploading an image for my thread and I got this This error what could be wrong
use withFileUploads:
public $images = [];
$thread = Thread::create([
'user_id' => auth()->user()->id,
'title' => $this->title,
'space_id' => $this->space,
'body' => $this->body,
'filename' => $this->images,
]);
foreach ($this->images as $key => $image) {
$path = $image->storeAs('gallery', str::random(30));
$images = Image::make($image)->fit(1280, 720);
Storage::put($path, (string)$images->encode());
ThreadImages::create([
'thread_id' => $thread->id,
'filename' => $path,
]);
}
remove
'filename' => $this->images,
Please or to participate in this conversation.