Level 1
any help
I am trying to save some images to the database but it's not been uploaded to the database how can I solve this
public function store(Request $request) {
$thread = [
"title" => $request->title,
"body" => $request->content,
"user_id" => auth()->user()->id,
"space_id" => $request->space,
];
foreach ($request->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,
]);
}
$thread = Thread::create($thread);
return back()->with("success", "Topic has been created");
}
Please or to participate in this conversation.